Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- def wtf()
- x = 1
- def inc_x()
- x += 1
- x
- end
- inc_x()
- x
- end
- puts "Hello world: " + wtf().to_s
- # Result is:
- #./stupid.rb:5:in `inc_x': undefined method `+' for nil:NilClass (NoMethodError)
- # from ./stupid.rb:8:in `wtf'
- # from ./stupid.rb:11:in `<main>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement