RETURN
Syntax: #RET value
Related: #RESULT, #FUNCTION
Must be used within a function - sets the value to be returned by that function and exits the function. To set the return value without exiting, see the #RESULT command.
RETURN Example
#FUNCTION MySum($a,$b) {#RETURN ($a+$b)}
Creates a function that returns the sum of it's given two arguments. For example, @MySum(1,3) would return the value of 4.
#FUNCTION Example {#RETURN "a value";#SAY "a command"}
The #SAY command is never executed because #RETURN exits the function.
#FUNCTION AnotherExample($a,$b) {#IF (!$a or !$b) {#RETURN 0};#RETURN 1}
A slightly more complex example, but one that's common in many languages. |