Loop over multiple arrays simultaneously: Difference between revisions
Loop over multiple arrays simultaneously (view source)
Revision as of 04:42, 3 July 2024
, 3 days agoAdded Vim Script solution
(Add Uiua) |
(Added Vim Script solution) |
||
Line 4,670:
cC3
</pre>
=={{header|Vim Script}}==
<syntaxhighlight lang="vimscript">
let a1 = ['a', 'b', 'c']
let a2 = ['A', 'B', 'C']
let a3 = [1, 2, 3]
for i in range(0, len(a1) - 1)
echo a1[i] .. a2[i] .. a3[i]
endfor
</syntaxhighlight>
If either a2 or a3 have fewer list items than a1, Vim will error with the message:
<pre>E684: List index out of range</pre>
If either a2 and/or a3 have more list items than a1, list items with index > len(a1) - 1 are ignored.
=={{header|Visual FoxPro}}==
|