Syntax
Return statements come in many shapes. The following syntaxes are most common:
| Language | Return Statement | If value omitted, Return |
|---|---|---|
| Ada, C, C++, Java, PHP, C#, JavaScript | return value; | in C and C++, undefined if function is value-returning |
| BASIC | RETURN | |
| Lisp | (return value) | last statement value |
| Perl, Ruby |
return @values;
return $value;
return;
or a contextual return sequence |
last statement value |
| Python | return value | None |
| Smalltalk | ^ value | |
| Visual Basic .NET | Return value | |
| Windows PowerShell | return value; | object |
| x86 assembly | ret | contents of eax register (by convention) |
Read more about this topic: Return Statement