Here's a piece of code:
Global $Array[5] = ["AA", "BB", "CC", "DD", "EE"]
For $I = 2 To $Array
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $I = ' & $I & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
Next
The results for this piece of code are very strange:
Is this a bug with the For code, in that it's acting somewhat like a For/Next loop, and somewhat like a For/In/Next loop? By the way, it doesn't matter what the first number in the loop is, I used 2 as an example, it will always output the same. It takes the number you started the loop at, and then the variable will hold the contents of the second through the last array elements.
On a 2D array, it still doesn't work as expected, but it works differently than how I'd expect it to.
Global $Array[5][2] = [["AA", "1"], ["BB", 2], ["CC", 3], ["DD", 4],["EE", 5]]
For $I = 10 To $Array
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $I = ' & $I & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
Next
This outputs:
Which is 5 instances of $ being 10, which seems to be a quick way of looping through an array if you don't need to access the contents of the array.