Skip to content

Instantly share code, notes, and snippets.

@ToadJamb
Created May 29, 2014 16:37
Show Gist options
  • Select an option

  • Save ToadJamb/d8d0da81d6c6b929f346 to your computer and use it in GitHub Desktop.

Select an option

Save ToadJamb/d8d0da81d6c6b929f346 to your computer and use it in GitHub Desktop.
ruby weirdness
class TestApp
def run
puts "foo is correctly 'foo': #{foo.inspect}"
unless foo
puts 'foo is nil' # This line is never hit, but the next line appears to get executed.
foo = nil # Remove this line and it works as expected.
end
puts "foo is incorrectly nil: #{foo.inspect}"
end
def foo
'foo'
end
end
TestApp.new.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment