On Jun 8, 5:05 am, Robert Klemme <shortcut... / googlemail.com> wrote:
> On 08.06.2008 06:00, jzakiya wrote:
>
>
>
> > On Jun 7, 11:35 pm, Rimantas Liubertas <riman... / gmail.com> wrote:
> >>> But you can't do this:
> >>> n1, n2, n3, n4 = [something]
> >> Just add one simbol and you can:
>
> >> $ irb --simple-prompt>> n1, n2, n3, n4 = *[1, 2, 3, 4]
> >> => [1, 2, 3, 4]
> >>>> n1
> >> => 1
> >>>> n2
> >> => 2
> >>>> n3
> >> => 3
> >>>> n4
> >> => 4
>
> >>> And you can't do this:
> >>> n1, n2, n3, n4  [+,-,*, etc]= [something]
> >> Not sure what you want here.
>
> >> <...> Make the software work more for the user, and not the other
>
> >>> way around.
> >> Make sure you know the software.
>
> !
>
> > Sorry for the confusion.
>
> > I want to set multiple variable to the same value:
>
> > n1, n2, n3, n4 = 5
>
> Your variable naming indicates that you are probably using the wrong
> tool: you rather want an Array of values vs. a number of variables.  If
> you do that, life becomes much easier:
>
> > and  do +=, -=, *=, etc with the same value
>
> > n1, n2, n3, n4 += 5
>
> ns.map! {|n| n + 5}
>
> Kind regards
>
>         robert

The names of the variables are not array values, they
are just different variable names, they could be any
names.

Remember, I would LIKE ruby to be able to do this.
It is my "whishlist".  I know Ruby doesn't do it now,
but I would like it to be able to in the future. OK! :-)

Peace

Jabari