Loop over multiple arrays simultaneously: Difference between revisions
Content added Content deleted
(Add Uiua) |
(Added Vim Script solution) |
||
Line 4,670: | Line 4,670: | ||
cC3 |
cC3 |
||
</pre> |
</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}}== |
=={{header|Visual FoxPro}}== |