Skip to content

Instantly share code, notes, and snippets.

@naohaq
Created May 29, 2012 02:41
Show Gist options
  • Save naohaq/2822220 to your computer and use it in GitHub Desktop.
Save naohaq/2822220 to your computer and use it in GitHub Desktop.
Top level local variable in Ruby
load "foo.rb"
puts a # Error!
def foo
puts a # Error!
end
a = 1
# This is ok.
puts a
# # This causes an error.
# foo()
@loveybot
Copy link

Yay Ruby!!

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