rhai/doc/src/language/return.md

17 lines
440 B
Markdown
Raw Normal View History

2020-06-20 06:06:17 +02:00
Return Values
=============
{{#include ../links.md}}
2020-06-21 18:03:45 +02:00
The `return` statement is used to immediately stop evaluation and exist the current context
(typically a function call) yielding a _return value_.
2020-06-20 06:06:17 +02:00
```rust
return; // equivalent to return ();
return 123 + 456; // returns 579
```
2020-06-21 18:03:45 +02:00
A `return` statement at _global_ level stop the entire script evaluation,
the return value is taken as the result of the script evaluation.