Help me understand this

I have my own theory, but I haven't seen the implementation yet. Or
maybe it's something simple, and I am just making things complicated.
Here goes:

-> irb
irb(main):001:0> b,c = 1,2
=> [1, 2]
irb(main):002:0> a = b,c = 1,2
=> [1, 1, 2]
irb(main):003:0> a
=> [1, 1, 2]
irb(main):004:0> a.inspect
=> "[1, 1, 2]"
irb(main):005:0> a.class
=> Array
irb(main):006:0>

···

--
Posted via http://www.ruby-forum.com/.

#...

this,

b,c = 1,2

=> [1, 2]

b

=> 1

c

=> 2

compare to this,

b,c = [1,2]

=> [1, 2]

b

=> 1

c

=> 2

then,

a = b,c = 1,2

=> [1, 1, 2]

a

=> [1, 1, 2]

b

=> 1

c

=> 1

compare

a = [b,(c = 1),2]

=> [1, 1, 2]

a

=> [1, 1, 2]

b

=> 1

c

=> 1

it's an array all to the right...

···

From: Elpee Zit [mailto:elpeeo@yahoo.com]

Thank You !!!!

···

--
Posted via http://www.ruby-forum.com/.