Documentation

#RETURN

Added in v2.0

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

The #SAY command is never executed because #RETURN exits the function.

#FUNCTION AnotherExample

A slightly more complex example, but one that's common in many languages.

Add comment

Login or register to post comments