Help me decipher this output
Posted
by Bragaadeesh
on Stack Overflow
See other posts from Stack Overflow
or by Bragaadeesh
Published on 2010-05-24T08:52:51Z
Indexed on
2010/05/24
9:11 UTC
Read the original article
Hit count: 299
Hi,
I have started learning Ruby recently and I was trying out the following piece of code.
a=[1,2]
b='slam dunk'
a.each { |b| c=a*b; puts c;}
I am getting the following output. I have no clue why. I expected an error or something to be thrown. Can someone explain me why this happens?
1
2
1
2
1
2
Thanks
© Stack Overflow or respective owner