From: Robert Klemme Date: 2008-10-17T00:19:34+09:00 Subject: Re: newbie adding to array question On 16.10.2008 16:50, Roger Reeks wrote: > hi, i have the following code in my project > > > def next_seq > > x = @current + @previous > > @previous = @current > > @current = x > > end > > > > def display_all > > count = 2 > while count < @iteration > > next_seq > > count = count + 1 > puts @current > > end > > end > > > > ive been trying to add the result each time the result is calculated to > array but keep getting stuck > > my idea was puttting @fibresults[count] = @current in the while loop, > but i keep getting nil when i try and access it later on You should disclose more of your code so we can see where it does not work. There is no @fibresults in the code above so we cannot know what went wrong. Cheers robert