]> ocean-lang.org Git - ocean/blobdiff - csrc/oceani-tests.mdc
oceani: add "and then" and "or else"
[ocean] / csrc / oceani-tests.mdc
index f5f097a1b4ac0a77c648552fb0f00658fa710084..b2c2e1b75f5f282ebb126c9e29ec93e0396ca8a6 100644 (file)
@@ -157,6 +157,15 @@ Now we need to test if/else and some different loops
                        count = count + 1
                print "error is ", target - guess * guess
 
+               for j:=0; then j = j+3 ; while j < 10:
+                       if j != 0 and then 20 / j > 3:
+                               print "20 /", j," =", 20 / j
+                       else:
+                               print "I won't calculate 20 /", j
+               pi ::= 3.1415926535897
+               if 355/113 == pi or else +(pi - 355/113) < 0.001:
+                       print "Close enough"
+
 ###### output: cond_loop
        Success
         1 2 4 8 16 32 64
@@ -165,6 +174,11 @@ Now we need to test if/else and some different loops
        2 1.41422
        3 1.41421
        error is  -4.51095e-12
+       I won't calculate 20 / 0
+       20 / 3  = 6.66667
+       20 / 6  = 3.33333
+       I won't calculate 20 / 9
+       Close enough
 
 ## Say Hello