Help me decipher this output
- by Bragaadeesh
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