From: "MetalOne" <jcb / iteris.com>


> The while loop version was slower yet.
> A function call to index an array?  Yikes!  Well, that might explain it.

:) There you go.  That's the price you pay for convenience: no memory issues
for out-of-bounds indexing; ability to index from the end; ability to take a
slice of the array.

In short:

       a = [ "a", "b", "c", "d", "e" ]
       a[2] +  a[0] + a[1]   #=> "cab"
       a[6]                  #=> nil
       a[1, 2]               #=> ["b", "c"]
       a[1..3]               #=> ["b", "c", "d"]
       a[4..7]               #=> ["e"]
       a[6..10]              #=> nil
       a[-3, 3]              #=> ["c", "d", "e"]

Gavin