Monday, March 22, 2010

infinite recursion

If you shovel an array into itself, it causes an infinite recursion. Watch me get dizzy in irb:

>> whoa = ["one", "two", "three"]
=> ["one", "two", "three"]
>> whoa << whoa
=> ["one", "two", "three", [...]]
>> whoa[3]
=> ["one", "two", "three", [...]]
>> whoa[3][3][3]
=> ["one", "two", "three", [...]]

by the set of all sets, ain't that cool.

No comments:

Post a Comment