On Tue, Jun 19, 2001 at 06:04:53AM +0900, Dave Thomas wrote: > In Ruby, you really have no idea that > > a[1] = 2 > > is an array assignment. For example > > class Dave > attr :value > def []=(n, val) > @value = val * n > end > end > > d = Dave.new > > d[2] = "foo" > > p d.value #=> "foofoo" > > d[3] = 7 > d.value #=> 21 Ah. Well to be honest that kinda sucks :). I was trying to write a method to print out pascal's triangle and kept getting error: undefined method []= for nil until I finally remembered we have to assign to [] first. grrr :)