Loop over multiple arrays simultaneously: Difference between revisions

→‎{{header|Raku}}: add a roundrobin example
No edit summary
(→‎{{header|Raku}}: add a roundrobin example)
Line 2,867:
 
<lang perl6>for <a b c d>.kv -> $i, $letter { ... }</lang>
 
=== Iterate until all exhausted ===
 
If you have different sized lists that you want to pull a value from each per iteration, but want to continue until '''all''' of the lists are exhausted, we have <code>roundrobin</code>.
 
<lang perl6>.put for roundrobin <a b c>, 'A'..'G', ^5;</lang>
{{out|yields}}
<pre>a A 0
b B 1
c C 2
D 3
E 4
F
G</pre>
 
=={{header|Red}}==
10,333

edits