Bug #12569
Updated by nobu (Nobuyoshi Nakada) over 9 years ago
In second sample we don't have any warnings or errors with wrong comma after last attr_accessor attribute and without it is very difficult to identify the typo. initialize method does not performed. ## It works **It works** ```ruby class Solution attr_accessor :one, :two, :three def initialize @one = @two = @three = [] puts "Done!" end end solution = Solution.new p solution.one p solution.two p solution.three **Result:** ``` ## Result: ``` MacBook-Air-Roman% ruby ruby_solution.rb Done! [] [] [] ``` ## it **it does not work work** ```ruby class Solution attr_accessor :one, :two, :three, def initialize @one = @two = @three = [] puts "Done!" end end solution = Solution.new p solution.one p solution.two p solution.three **Result** ``` ## Result ``` MacBook-Air-Roman% ruby ruby_solution.rb nil nil nil ```