From: Mang o'Lloyd Date: 2010-05-19T02:41:56+09:00 Subject: Re: Deaf grandma - almost there Jonathan Nielsen wrote: > It doesn't work because of scope. When you set 'byes = 0' in def > reset, you are setting a local variable with scope inside the reset > method. This is not the same as a local variable in the 'main' scope. > > One way to fix this by using an 'instance' scope. Even though you > aren't technically in a class instance, at some level of abstraction > the default binding is an instance of a class. So, instead of 'byes' > as a variable, you could use '@byes'. > > -Jonathan Nielsen Thanks Jonathan, that fixed it! I guess I got ahead of myself by using a method before fully understanding scope. Lesson learnt :) -- Posted via http://www.ruby-forum.com/.