Name
Parallel Assignment
Synopsis
target
[,target
...][, *target
] =expr
[,expr
...][, *expr
]
Targets on the left side receive
assignment from their corresponding expressions on the right side. If
the last left-side target is preceded by *
, all
remaining right-side values are assigned to the target as an array.
If the last right-side expression is preceded by
*
, the array elements of expression are expanded
in place before assignment.
If there is no corresponding
expression, nil
is assigned to the target. If
there is no corresponding target, the value of right-side expression
is just ignored.
Get Ruby in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.