diff options
Diffstat (limited to 'doc/DESIGN.md')
-rw-r--r-- | doc/DESIGN.md | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/doc/DESIGN.md b/doc/DESIGN.md index fae9ef2..f9e3cef 100644 --- a/doc/DESIGN.md +++ b/doc/DESIGN.md @@ -13,7 +13,9 @@ const main = fn { ``` const main = fn { var value = 23 + 50; - if value < 23 + if value == 0 + stderr.writeln("zero!"); + else if value < 23 stderr.writeln("less!"); else stderr.writeln("more!"); @@ -28,20 +30,14 @@ const main = fn { ## Closure Parentheses after `fn` is only required when the closure has parameters or returns data ``` -const apply = fn(func: () bool) { +const apply = fn(func: fn() bool) { const result = func(); } const main = fn { - // Return type is automatically deduced. If function returns multiple different types at different points, - // then you get an error and are required to specify the return type - apply(fn { - return true; - }) - apply(fn() bool { return true; - }) + }); // Or store in a variable and use it const func = fn { |