# Re: Loop weirdness

**URL:** <https://www.ruby-forum.com/t/re-loop-weirdness/99365>\
**Category:** Ruby\
**Created:** [January 31, 2006, 2:06pm UTC](https://www.ruby-forum.com/t/re-loop-weirdness/99365 "2006-01-31T14:06:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KroegerS\_Simon\_Sext](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/57b2e6/32.png) [@KroegerS\_Simon\_Sext](https://www.ruby-forum.com/u/KroegerS_Simon_Sext)\
**Post date:** [January 31, 2006, 2:06pm UTC](https://www.ruby-forum.com/t/re-loop-weirdness/99365/1 "2006-01-31T14:06:04Z")

</div>

> 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
