mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
While and for loops are working
This commit is contained in:
@@ -18,4 +18,23 @@ else {
|
||||
}
|
||||
|
||||
|
||||
print "All good";
|
||||
//test while loop
|
||||
var whileCounter = 0;
|
||||
while (whileCounter < 10) {
|
||||
whileCounter = whileCounter + 1;
|
||||
}
|
||||
|
||||
assert whileCounter == 10, "while-loop failed";
|
||||
|
||||
|
||||
//test for loop
|
||||
var forCache = 0;
|
||||
for (var i = 0; i < 20; i = i + 1) {
|
||||
forCache = i;
|
||||
}
|
||||
|
||||
assert forCache == 19, "for-loop failed";
|
||||
|
||||
|
||||
print "All good";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user