Iterating through two collections in parallel
What method will execute a two-parameter block with corresponding pairs of elements from two separate Ordered Collections. something like this example: #(1 2 3) and: 'abc' do: [ :aNumber :aLetter | do something first with 1 and $a, then with 2 and $b, and finally with 3 and $c ] I searched for âcorrespondingâ and âpairsâ and failed to find what Iâm looking for. I tried âzipâ. Itâs hard to search for this with an example. Andrew
Hi Try this one: #(1 2 3) with: 'abc' do: [ :aNumber :aLetter | do something first with 1 and $a, then with 2 and $b, and finally with 3 and $c ] 2017-11-14 10:10 GMT+01:00 Prof. Andrew P. Black <black@cs.pdx.edu>:
What method will execute a two-parameter block with corresponding pairs of elements from two separate Ordered Collections.
something like this example:
#(1 2 3) and: 'abc' do: [ :aNumber :aLetter | do something first with 1 and $a,
then with 2 and $b,
and finally with 3 and $c ]
I searched for âcorrespondingâ and âpairsâ and failed to find what Iâm looking for. I tried âzipâ. Itâs hard to search for this with an example.
Andrew
participants (2)
-
Denis Kudriashov -
Prof. Andrew P. Black