From: Parv G Date: 2006-06-17T05:25:15+09:00 Subject: Re: undefined method (noMethodError) Stefan Mahlitz wrote: > If you want the object to change its content you will have to define > instance variables. > > def initialize > @col = 'A' > end > > In nextcell you have to change all occurences of 'col' to '@col'. > > Stefan Thanks Stefan. After using the instance variables through out i'm still getting the same results for both of method class; the variable value is not changing. Here's the code: class TestClass def initilize @col = 'A' @row = 1 @maxCol = 'H' @maxRow = 5 @myNextCell = '' end def nextcell @col = 'A' @row = 1 @maxCol = 'H' @maxRow = 5 if (@col < @maxCol) @myNextCell = @col + @row.to_s @col = @col.next puts("Next Cell is #{@myNextCell}") return @myNextCell else @row.next @myNextCell = @col + @row.to_s @col.next return @myNextCell end end tc = TestClass.new puts tc.nextcell.inspect puts tc.nextcell.inspect end Thanks, appreciate your help. -- Posted via http://www.ruby-forum.com/.