X-Git-Url: https://ocean-lang.org/code/?a=blobdiff_plain;f=csrc%2Foceani-tests.mdc;h=55e8477468518ee120591502b99ae489c5d94d95;hb=a9cd2fcd52ae4ba9c19f775221cc14d2745083b3;hp=e7e9f22486df6bdac410d996b2d7de05f7bd4e1b;hpb=19148dce964ae988dab3981c8d7365576fb4767b;p=ocean diff --git a/csrc/oceani-tests.mdc b/csrc/oceani-tests.mdc index e7e9f22..55e8477 100644 --- a/csrc/oceani-tests.mdc +++ b/csrc/oceani-tests.mdc @@ -282,9 +282,10 @@ Here I break it into two parts, keeping the array code separate. ###### test: sayhello - program As Bs astr bbools: - A := $As; B := $Bs - bbool := bbools == "True" + program ac av: + A := $av[1]; B := $av[2] + astr := av[3] + bbool := av[ac-1] == "True" print "Hello World, what lovely oceans you have!" /* When a variable is defined in both branches of an 'if', * and used afterwards, the variables are merged. @@ -555,7 +556,7 @@ Time to test if structure declarations and accesses work correctly. struct foo size:[three]number name:string - active:Boolean + active:Boolean = True struct baz { a:number; b:Boolean; } @@ -571,7 +572,8 @@ Time to test if structure declarations and accesses work correctly. info[i].name = nm info[i].size[0] = i*i - info[i].active = nm == "jane" + if nm != "jane": + info[i].active = False for i:=0; then i=i+1; while i < 4: print info[i].name, info[i].active, info[i].size[0]