Feeding arrays in loop Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
adegard
Posts: 90
Joined: 24 Nov 2017, 05:58
Contact:

Feeding arrays in loop

Post by adegard » 24 Nov 2017, 07:23

Hi everybody!
I try to feed an array in a loop for but it return me nothing when I launch the code to read it...
What's wrong? :shock: Thanks!

Code: Select all

; Create an array
myArray := []

; Add values to the array
i:=0
while(i<3)
{
i++
z:=i*3 ;my equation to feed the array
myArray.insert(%z%)
}

Sleep 500
; Loop through the array
for each, value in myArray {
    ; each holds the index
    ; value holds the value at that index
    msgBox, Ittr: %each%, Value: %value%
}

return
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Feeding arrays in loop  Topic is solved

Post by Nextron » 24 Nov 2017, 08:10

Remove the %'s around the z. Within a function/method, everything is evaluated as an expression already.
User avatar
adegard
Posts: 90
Joined: 24 Nov 2017, 05:58
Contact:

Re: Feeding arrays in loop

Post by adegard » 24 Nov 2017, 08:52

ok, thank you Nextron! it works.
Post Reply

Return to “Ask for Help (v1)”