Re: Loop weirdness

the array. However, you are using two in your block. I
understand (from
looking at the code), that this assigns each value in the
item array to
k and v respectively, but how does that work? Is there any docs about
that anywhere?

that’s the way multiple assignement works in ruby

a, b = 1, 2

a, b = [1, 2]

is equivalent (at least for this purpose).

map yields arrays of two elements in this case and I’m assigning them to
two variables.

cheers

Simon

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs