main() { magicNumber = 123 if magicNumber == 123 print("Found the magic number") //if an else follows, no need for curly braces else { print("$magicNumber is not the magic number") } //loops simpleArray = [9, 8, 7] test1 := [] //dynamic array for v in simpleArray { test1.Push(v) } for v in simpleArray index i { test1.Push(i)} assert(test1 == [9,8,7,0,1,2]) for i to 3 { print("$i") } //prints 0 1 2 on a newline each for i to 10 inc 3 { print("$i") } //0 3 6 9 sum := 0 for i mut to 10 { i .= 9; sum += i; } assert(sum == 9) loopTest([]) loopTest([1, 2]) loopTest([9]) switchTest("Hello") switchTest("Bob") switchTest2(4) switchTest2(9) } loopTest(int data[]) { sum := 0 for v in data { if v == 2 break //break/continue/return don't need { } sum += v } on break { print("Executed on break") } on empty { print("Executed on empty") } on complete { print("Got to end of loop") } } switchTest(string word) { switch word { "Hello" => print("Hello world") print("Another statement") // => seperates the cases _ => print("Hi $word") //_ is default case } } switchTest2(int v) { switch v { 4 => print("Value is four") _ => print("Value is $v") } }