mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Implemented scopes
This commit is contained in:
19
tests/integrations/test_variables.toy
Normal file
19
tests/integrations/test_variables.toy
Normal file
@@ -0,0 +1,19 @@
|
||||
//declare a variable with an initial value
|
||||
var answer = 42;
|
||||
|
||||
//declare a variable without an initial value
|
||||
var empty;
|
||||
|
||||
//assign a previously existing variable
|
||||
answer = 6 * 9;
|
||||
|
||||
//access a variable
|
||||
answer = answer + 1;
|
||||
|
||||
//compound assignments
|
||||
answer += 5;
|
||||
answer -= 5;
|
||||
answer *= 9;
|
||||
answer /= 2;
|
||||
answer %= 10;
|
||||
|
||||
Reference in New Issue
Block a user