Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foo := "foo"
- Scope := Object clone do(
- bar := "bar" // can access `foo` and `bar` after this point
- scopeMethod := method(
- baz := "baz" // can access `foo`, `bar` and `baz` after this point
- if(2 + 2 != 5) then(
- fuzz := "fuzz"// can access `foo`, `bar`, `baz` and `fuzz` after this point
- ) else(
- // can't access fuzz, it wouldn't have been created
- )
- // can access `foo`, `bar`, `baz` and `fuzz` (if it was created) at this point.
- )
- additionalScopeMethod := method(
- foo = "still foo" // can only access `foo` & `bar` here
- )
- )
- AdditionalScope := Object clone do(
- additionalScopeMethod := method(
- // can only access `foo` at this point
- )
- )
Add Comment
Please, Sign In to add comment