The Squirrel interpreter. See http://www.squirrel-lang.org/
Diff: samples/loops.nut
- Revision:
- 0:97a4f8cc534c
diff -r 000000000000 -r 97a4f8cc534c samples/loops.nut --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/loops.nut Tue Dec 16 10:20:34 2014 +0000 @@ -0,0 +1,32 @@ +local arr=["one","two","three"] + +::print("FOREACH\n"); + +foreach(i,val in arr) +{ + ::print("index ["+i+"]="+val+"\n"); +} + +::print("FOR\n"); + +for(local i=0;i<arr.len();i+=1) +{ + ::print("index ["+i+"]="+arr[i]+"\n"); +} + +::print("WHILE\n"); + +local i=0; +while(i<arr.len()) +{ + ::print("index ["+i+"]="+arr[i]+"\n"); + i+=1; +} +::print("DO WHILE\n"); + +local i=0; +do +{ + ::print("index ["+i+"]="+arr[i]+"\n"); + i+=1; +}while(i<arr.len()); \ No newline at end of file