Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.30 KB | None | 0 0
  1. #!/usr/bin/ruby
  2. def wtf()
  3.   x = 1
  4.   def inc_x()
  5.     x += 1
  6.     x
  7.   end
  8.   inc_x()
  9.   x
  10. end
  11. puts "Hello world: " + wtf().to_s
  12. # Result is:
  13. #./stupid.rb:5:in `inc_x': undefined method `+' for nil:NilClass (NoMethodError)
  14. #        from ./stupid.rb:8:in `wtf'
  15. #        from ./stupid.rb:11:in `<main>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement