The first thing that really surprised me today was the flexibility of Ruby's shovel operator, <<
. A student in the class had tried the following:
a = [0]
a << a
What do you think a
is now? I was sure it would be [0, [0]]
. But lo and behold, Ruby sparkles;
a = [0]
a << a