looping through arrays Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
awcrt9316
Posts: 61
Joined: 03 Mar 2020, 20:06

looping through arrays

08 Apr 2020, 13:36

I would like to be able to be able to retrive an array through array.red.1 or array.red.3. I can do this right now, but i am not sure if this is the most "profesisonal" way to do it. I basically just found out this works by trying out random stuff. I would also be able to loop through it and have a msgbox that displays each value (which currently is not working)

Code: Select all

array := []
array["red"]:= {1: 4, 2: 7, 3: 11}
i := 0
for index, value in array
{
	msgbox, % array.rook.i 
	i++
}
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: looping through arrays  Topic is solved

08 Apr 2020, 13:59

Code: Select all

Object := {}
Object["red"] := [4, 7, 11]

for color, Array in Object
{
	for index, number in Array
	{
		MsgBox % number
	}
}
awcrt9316
Posts: 61
Joined: 03 Mar 2020, 20:06

Re: looping through arrays

08 Apr 2020, 14:01

@swagfag thx for your help!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bobak and 253 guests