fork(1) download
  1. # your code goes here
  2. class Foo
  3. attr_accessor :num
  4. def initialize
  5. @num = 1
  6. end
  7. def inc
  8. puts num.class
  9. puts num
  10. num = (num + 1)
  11. end
  12. end
  13.  
  14. puts Foo.new.inc
Runtime error #stdin #stdout #stderr 0s 6316KB
stdin
Standard input is empty
stdout
Integer
1
stderr
prog.rb:10:in `inc': undefined method `+' for nil:NilClass (NoMethodError)
	from prog.rb:14:in `<main>'