I’reading “pragmatic programmers guide” on ruby-doc site.
this simple example, written on irb shell,
@@plays = 0
def initialize(name, artist, duration)
@name = name
@artist = artist
@duration = duration
@plays = 0
@plays += 1
@@plays += 1
“This song: #@plays plays. Total #@@plays plays.”
after to have insert some simple data,
when executed method “play”,
return me that error :
undefined method `+’ for nil:NilClass
is not possible use operator “+=” ?
I don’t believe that !!
any suggestions ?
thank’s in advance
bye by fellons