Return Value¶
return
¶
The return
statement is used to immediately stop evaluation and exist the current context (typically a function call) yielding a return value.
A return
statement at global level exits the script with the return value as the result.
A return
statement inside a function call exits with a return value to the caller.
exit
¶
Similar to the return
statement, the exit
function is used to immediately stop evaluation, but it does so regardless of where it is called from, even deep inside nested function calls.
The result value of exit
, when omitted, defaults to ()
.