A valid array index needs to be less than or equal to the array length. Ier := [] creates an array with a length of 0.
In the first iteration of the loop, it tries to set Ier[1] := []. 1 is an invalid index because it's greater than Ier.length.
You can set the length after creating Ier:
Or push an array instead:
In the first iteration of the loop, it tries to set Ier[1] := []. 1 is an invalid index because it's greater than Ier.length.
You can set the length after creating Ier:
CODE:
#Requires Autohotkey v2.0
#SingleInstance Force
Ier := []
Ier.Length := 8
Aer := ["a", "b", "c", "d", "e", "f","g","h"]
Loop 8
{
Ier[A_index] := []
Ier[A_Index].Push(Aer[A_index])
}
MsgBox Ier[2][1]
Or push an array instead:
CODE:
#Requires Autohotkey v2.0
#SingleInstance Force
Ier := []
Aer := ["a", "b", "c", "d", "e", "f","g","h"]
Loop 8
{
Ier.Push([])
Ier[A_Index].Push(Aer[A_index])
}
MsgBox Ier[2][1]
Statistics: Posted by ntepa — Today, 17:55