Skip to content

Instantly share code, notes, and snippets.

@mmalecki
Created March 10, 2012 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmalecki/7633977555958fa117a1 to your computer and use it in GitHub Desktop.
Save mmalecki/7633977555958fa117a1 to your computer and use it in GitHub Desktop.
@var g = 1
func0 () {
print(g) // what will it print?
}
func1 () {
@var g = 2
print(g) // what will it print?
}
func2 (g) {
print(g)
}
func2(3) // what will it print?
@indutny
Copy link

indutny commented Mar 10, 2012

  1. nil
  2. change to @g = 2, and it'll return 2
  3. 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment