mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Postfix '++' & '--' works (prefix & postfix are both tested)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
//standard example, using 'while' instead of 'for', because it's not ready yet
|
||||
|
||||
var counter: int = 1;
|
||||
var counter: int = 0;
|
||||
|
||||
while (counter <= 100) {
|
||||
while (++counter <= 100) {
|
||||
var result: string = "";
|
||||
|
||||
if (counter % 3 == 0) {
|
||||
@@ -20,7 +20,5 @@ while (counter <= 100) {
|
||||
else {
|
||||
print counter;
|
||||
}
|
||||
|
||||
counter += 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,5 +9,18 @@
|
||||
assert --a == 42;
|
||||
assert a == 42;
|
||||
|
||||
print a;
|
||||
}
|
||||
|
||||
|
||||
//increment & decrement (postfix)
|
||||
{
|
||||
var a = 42;
|
||||
assert a == 42;
|
||||
assert a++ == 42;
|
||||
assert a == 43;
|
||||
assert a-- == 43;
|
||||
assert a == 42;
|
||||
|
||||
print a;
|
||||
}
|
||||
Reference in New Issue
Block a user