Matt Gretton wrote: > Hello all, > > I have a quick question regarding the way the size instance method works > for Arrays. > > When an array is asked for its size multiple times in a piece of code > (say a method). Which of the following happens? > > a) The size is calculated every time the array is asked for it. > b) The size is assigned to an instance variable the first time it is > calculated and then returned when the array is subsequently asked for > its size. > > Any reply to this question would be gladly received. > > Thanks in advance. > > Matt. > > Ruby always knows the current size of the array. It doesn't have to be calculated on demand.