-
-
Notifications
You must be signed in to change notification settings - Fork 4
return
Auto edited this page May 1, 2022
·
4 revisions
Since everything is an expression, return statements at the end of functions and closures can be omitted.
Angle allows return type polymorphism
The return type of a function is denied by the as
keyword:
fib i as int:= if i<2 : 1 else fib(i-1) + fib i-2
Interestingly if the last parameter is untyped, the as keyword also weakly hints at the parameter type.
Different list separators have different bindings: While 1,2,3 binds as one expression, 1;2;3 yields the last element as return value.