From: Chuck Remes Date: 2011-08-23T01:38:25+09:00 Subject: Re: New to Ruby some problems On Aug 22, 2011, at 10:38 AM, Adam Prescott wrote: > On Mon, Aug 22, 2011 at 3:05 PM, Chuck Remes wrote: > >> Sorry, I didn't read the problem closely enough (too early in the >> morning!). You need to pass a ROW and COLUMN to set or get a value in your >> matrix instead of just a single value like I posted above. >> >> Something like this might be a good start (untested). >> >> class Matrix >> [...] >> >> def set(x, y, value) >> @array[index(x, y)] = value >> end >> >> def get(x, y) >> @array[index(x,y)] >> end >> >> [...] >> end >> > > Not sure if you know this, but you can actually still use the [] approach > with multiple arguments, to avoid "set" and "get" method names. A stupid > example: I did *not* know that! Thanks for telling me. cr