On 03.01.2007 23:58, Mark Woodward wrote:
> I suspected that but I couldn't understand how/why this could be done
> with a size 0.
> 
> @paths = Array.new(0,Array.new(0)) to me reads as "create a new array
> with nothing in it and make that nothing reference another empty
> array?"
> ie []

Nothing cannot really reference to anything, can it?

> @paths = Array.new(1,Array.new(0)) This, if my logic's right, reads as
> "create a new array with a single element that's an empty array.
> ie [[] ]

Even that could be more clearly done with

@paths = [[]]

> Are you saying that even though @paths is created as an empty array, it
> expects the first element it gets to be an array? If not it will throw
> an error?
> Sorry, I can't check this in irb ATM. 

No, there is no such error checking done.  There is also not a default 
value as with a Hash - an Array always returns nil when non existing 
elements are referenced.

Maybe the code was created and then modified several times leaving this 
artifact.  The shortest and also cleanest solution would probably be to 
just do

@paths = []

Kind regards

	robert