rhai/doc/src/language/return.md
2020-06-22 00:03:45 +08:00

440 B

Return Values

{{#include ../links.md}}

The return statement is used to immediately stop evaluation and exist the current context (typically a function call) yielding a return value.

return;             // equivalent to return ();

return 123 + 456;   // returns 579

A return statement at global level stop the entire script evaluation, the return value is taken as the result of the script evaluation.