From: Chris Bailey Date: 2008-08-29T11:19:30+09:00 Subject: Re: NoMethodError ? Chris Bailey wrote: > In the following code I am trying to print out the value of the > variable @symbol from an array of instances of the MapSector class. I > don't understand why I'm getting "NoMethodError: undefined method > `symbol' for #" after putting this in irb and typing: > foo = GameMap.new(5,5) > foo.show_map Well I figured out the first half of my problem. I guess my show_map method was trying to find the symbol variable inside the Array object, whoops. So I have updated the show_map method to the following. def show_map x = 0 y = 0 while x < @height while y < @width puts self.sectors[x][y].symbol y+= 1 end x += 1 end end The problem I am having now is that when the method is run on a 4x4 array of MapSectors it only prints out 4 symbols...it should be 16. I have verified that the nested arrays are all properly populated so I guess it just isn't iterating through them properly. Any ideas? -- Posted via http://www.ruby-forum.com/.