Statements
Closures in Knot can be empty or contain one or more statements.
Expression
Any expression is a valid statement.
knot
func foo -> {10 + 0.4;true && false;"fizz" == "buzz";};
knot
func foo -> {10 + 0.4;true && false;"fizz" == "buzz";};
Let Binding
If a let
binding is the last statement in the closure then the return value is implicitly nil
.
knot
func foo -> {let bar = 10;let fizz = bar - 3 > 10;let buzz = !fizz;};
knot
func foo -> {let bar = 10;let fizz = bar - 3 > 10;let buzz = !fizz;};