]> ocean-lang.org Git - ocean/blobdiff - csrc/oceani-tests.mdc
oceani: allow 'then' in simple if statements.
[ocean] / csrc / oceani-tests.mdc
index 8e4ddadd7e9bb07b387929dd05a1434f7692b62f..ab89bf27ccd52140f8b43a4a72c0ecf18d6d8ec0 100644 (file)
@@ -242,6 +242,16 @@ Now we need to test if/else and some different loops
                        print "Close enough"
                print "lower" if 355/113 < pi else "higher"
 
+               if pi > 3 then print "pi exceeds three"; else print "need more pie"
+               if (pi < 3) { print "not enough pi" } else { print "pi sufficient" }
+               for { i := 0; sum := 0 }
+               then { i = i+1 }
+               while i <= 10:
+                       sum = sum + i
+               else:
+                       pass
+                       print "sum 1..10 is", sum
+
 ###### output: cond_loop
        Success
         1 2 4 8 16 32 64
@@ -256,6 +266,9 @@ Now we need to test if/else and some different loops
        I won't calculate 20 / 9
        Close enough
        higher
+       pi exceeds three
+       pi sufficient
+       sum 1..10 is 55
 
 ## Say Hello