29 lines
478 B
Text
29 lines
478 B
Text
fn func()
|
|
-- function calls can be at level of statement
|
|
func()
|
|
-- or at the level of an expression
|
|
x = 1 + func()
|
|
|
|
-- unlabelled arguments
|
|
func(0, 1)
|
|
x = func(0, 1) * 2
|
|
-- labelled arguments
|
|
func(0, second: 1)
|
|
x = func(0, second: 1) & 7
|
|
-- shorthand for passing a variable as an argument with label of the
|
|
-- same name
|
|
func(=x)
|
|
x = 1 <= func(=x) <= 10
|
|
|
|
-- trailing comma is allowed
|
|
func(
|
|
0,
|
|
second: 1,
|
|
=x,
|
|
)
|
|
x = not func(
|
|
0,
|
|
second: 1,
|
|
=x,
|
|
)
|
|
end
|