RosettaCodeData/Task/Loop-over-multiple-arrays-simultaneously/AutoHotkey/loop-over-multiple-arrays-simultaneously-1.ahk

27 lines
593 B
AutoHotkey
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
List1 = a,b,c
List2 = A,B,C
List3 = 1,2,3
MsgBox, % LoopMultiArrays()
List1 = a,b,c,d,e
List2 = A,B,C,D
List3 = 1,2,3
MsgBox, % LoopMultiArrays()
;---------------------------------------------------------------------------
2015-11-18 06:14:39 +00:00
LoopMultiArrays()
{ ; print the ith element of each
2013-04-10 21:29:02 -07:00
;---------------------------------------------------------------------------
2015-11-18 06:14:39 +00:00
2013-04-10 21:29:02 -07:00
local Result
StringSplit, List1_, List1, `,
StringSplit, List2_, List2, `,
StringSplit, List3_, List3, `,
Loop, % List1_0
Result .= List1_%A_Index% List2_%A_Index% List3_%A_Index% "`n"
Return, Result
}