Functions
returning
Optional return type on a function or method.
Syntax
define func <name>(...) returning <type>;
How she behaves
- You may skip it. If you skip it, the type of the result is still on you.
- Works on file-level functions and on methods inside a class.
- The value you return should match the type you announced.
Example
define func sub(num x, num y) returning num; return x - y; end;