diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-03-16 16:26:13 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-03-16 16:26:13 -0400 |
commit | b7b3e0868b9eef1018f87bd1c81c0112abaf94f4 (patch) | |
tree | e9a754e867302b9949612fec639b7722967f94fc /test.toc | |
parent | 35459f4ef5c9076a331acecd0c16328326c4081b (diff) |
break, continue
Diffstat (limited to 'test.toc')
-rw-r--r-- | test.toc | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -1,17 +1,31 @@ #include "std/io.toc", io; -main ::= fn() { +f ::= fn() int { + total := 0; for i := 1..10 { if i % 2 == 0 { continue; } - io.puti(i); + total += i; if i == 7 { break; } } i := 0; while { i += 1; - io.puti(i); + total += i; if i == 10 { break; } } + while i < 100 { + i += 1; + if i == 100 { + return total; + } + } + 0 } + +main ::= fn() { + x ::= f(); + io.puti(x); + io.puti(f()); +}
\ No newline at end of file |