From: Brendan Hansen Date: Fri, 26 Jun 2020 20:06:26 +0000 (-0500) Subject: Stage 1 done; added test file for break/continue X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=74be407bfc9c0459c6a97c1aeabb624a09121b51;p=onyx.git Stage 1 done; added test file for break/continue --- diff --git a/docs/plan b/docs/plan index 109dcf6b..26de694b 100644 --- a/docs/plan +++ b/docs/plan @@ -59,8 +59,8 @@ HOW: [X] Comparison operators [X] Proper boolean type [X] Conditional branching works as expected - XX] Simple while loop is functioning as expected - [ ] break and continue semantics + [X] Simple while loop is functioning as expected + [X] break and continue semantics [X] Function calling works for the builtin types [X] Function return values are type checked diff --git a/progs/break_test.onyx b/progs/break_test.onyx new file mode 100644 index 00000000..a9023830 --- /dev/null +++ b/progs/break_test.onyx @@ -0,0 +1,40 @@ + +print :: foreign "host" "print" proc (val i32) --- + +export main :: proc { + + x := 0; + while x < 10 { + + if x == 4 { + + x := 1; + while x < 1000000 { + print(x); + + if x > 4 { break; } + + x = x + 1; + } + + } + + if x == 2 { + + x := 1; + while x <= 5 { + if x == 3 { + x = x + 1; + continue; + } + + print(x); + x = x + 1; + } + + } + + x = x + 1; + } + +}