Files
Toy/test/jumps.toy

40 lines
524 B
Plaintext

//test true jump
if (true) {
assert true, "if-then failed";
}
else {
assert false, "if-then failed";
}
//test false jump
if (false) {
assert false, "if-then failed";
}
else {
assert true, "if-then failed";
}
//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";