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_scopes.toy
Normal file
19
tests/integrations/test_scopes.toy
Normal file
@@ -0,0 +1,19 @@
|
||||
//shadowing
|
||||
var answer = 42;
|
||||
print answer; //42
|
||||
{
|
||||
var answer = 7;
|
||||
print answer; //7
|
||||
}
|
||||
print answer; //42
|
||||
|
||||
//rebinding
|
||||
var question = 42;
|
||||
print question; //42
|
||||
{
|
||||
var question = question;
|
||||
print question; //42
|
||||
}
|
||||
print question; //42
|
||||
|
||||
//TODO: scope test case
|
||||
Reference in New Issue
Block a user