Wiki source for CommandReturn


Show raw source

======Command return======

====Name====
**return** returns from a function

====Synopsis====
return value;


====Description====
**return** stops executing a function and returns from it with the value as the exit value of the function.
This becomes $? to the calling code.

Example
%%
function foo ()
{
if true ; then
return 1;
fi
echo This should never happen;
}

foo
echo $?
%%

Result
%%
1
%%


The return value of functions can be any expression, including XML Expressions, Java objects and sequences. The $? variable converts any non-numeric expression to a numeric value equivilent to the effective boolean of the expression. You can retrieve the native return value of functions by using them in assignment statments or passing as arguments using the [[SyntaxFunction function call]] syntax.




----
[[SyntaxFunction Functions]]
[[Commands]]
[[CategoryCommands]]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki