Skip to content

Instantly share code, notes, and snippets.

@hpjaj
Created December 6, 2014 21:12
Show Gist options
  • Save hpjaj/0d21e889d1a8a73ed604 to your computer and use it in GitHub Desktop.
Save hpjaj/0d21e889d1a8a73ed604 to your computer and use it in GitHub Desktop.
week 3 - 1e - Ten for Fifty
def method
a = 50
puts a
end
a = 10
method
puts a
=begin
This displays like so:
The 50 is displayed because line 7 calls the method "method" which puts its locally
scoped variable of a, which is assigned on line 2 to a value of 50
50
The 10 is displayed because on line 6 a top level local scope assigns a to 10
and then this top level variable is called on line 8, which prints 10
10
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment