Hi group.

Please have a look at the following:

irb(main):001:0> class F < Struct.new :n
irb(main):002:1>   def dec_n
irb(main):003:2>     n = n - 1
irb(main):004:2>   end
irb(main):005:1> end
=> nil
irb(main):006:0> f = F.new 1
=> #<struct F n=1>
irb(main):007:0> f.dec_n
NoMethodError: undefined method `-' for nil:NilClass
        from (irb):3:in `dec_n'
        from (irb):7
        from :0
irb(main):008:0>

I've tried to define a class which decrease n by 1, but failed. How can
I do that?

- Minkoo Seo