I was reading this example:

pt = [ [ "Check", "check" ], [ "Credit card", "cc" ], [ "Purchase
order", "po" ] ]
pt.map  {|value| value}

Displays the 2D Array elements as expected => [["Check", "check"],
["Credit card", "cc"], ["Purchase order", "po"]]

but a two-parameter block suppled to map like below:

>> pt.map  {|disp, value| value} 
=> ["check", "cc", "po"]

is able to give me the second element of the 2D array.

i looked in the ruby doc and on the net for examples, but 2D arrays are
typically not covered.

while, i love this functionality, my question is -

How does this 2 parameter variant really work?

How does the array.map "figure out" and pass disp to param1 and value to
param2?

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