Jcm Mz wrote:
> That I can see; Pragmatic Programming Ruby's, index, has reference to
> all sorts of symbols, but I can't find a explanation for a ',' seperator
> such as used in the following:
> 
>  var1 = 1; p var1 #=> 1
>  var2 = 2; p var2 #=> 2
>  var3 = 3; p var3 #=> 3
> 
>  var1, var2, var3 = 5
> 
>  p var1 #=> 5
>  p var2 #=> nil
>  p var3 #=> nil
> 
> What's happening here? I read it as:
> set var1 to 5 and reset var2 and var3 to nil.
> Is that all the comma does?

Consider:

irb(main):005:0> a,b,c = 5,6,7
=> [5, 6, 7]

irb(main):006:0> a
=> 5

irb(main):007:0> b
=> 6

irb(main):008:0> c
=> 7

Multiple assignment from array parameters is very useful as well...

ra_parm = [1,2,3]

def meth(ra_parm)
 p1, p2, p3 = ra
end

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