mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Added arithmetic assign operators
This commit is contained in:
@@ -12,4 +12,20 @@ assert 2.0 * 2.0 == 4.0, "2.0 * 2.0 == 4.0";
|
||||
assert 1.0 / 2.0 == 0.5, "1.0 / 2.0 == 0.5";
|
||||
|
||||
|
||||
var a = 10;
|
||||
|
||||
a += 20;
|
||||
a -= 25;
|
||||
|
||||
assert a == 5, "+= or -= failed";
|
||||
|
||||
a *= 5;
|
||||
a /= 2;
|
||||
|
||||
assert a == 12, "*= or /= failed";
|
||||
|
||||
a %= 8;
|
||||
|
||||
assert a == 4, "%= failed";
|
||||
|
||||
print "All good";
|
||||
Reference in New Issue
Block a user