Jump to content

Please Help With 3D Arrays "[Solved]"


Recommended Posts

Please help with this 3D Array the first example works the secound doesn't.

Need help to understand how Arrays work.

Many thanks in advance

;First Example

Dim $aArray[2][2][2]

$aArray[0][0][0] = 1
$aArray[0][0][1] = 2
$aArray[0][1][0] = 3
$aArray[0][1][1]  = 4

$aArray[1][0][0] = 5
$aArray[1][0][1] = 6
$aArray[1][1][0] = 7
$aArray[1][1][1] = 8


For $a = 0 to 1
    for $b = 0 to 1
        for $c = 0 to 1

ConsoleWrite($aArray[$a][$b][$c] & @CRLF)

        Next
    Next
Next


;Secound Example

Local $aArraym [2][2][2]=[[[1,2,],[3,4],[5,6],[7,8]]]




For $a = 0 to 1
    for $b = 0 to 1
        for $c = 0 to 1

ConsoleWrite($aArraym[$a][$b][$c] & @CRLF)

        Next
    Next
Next

 

Edited by Mannyfresh31
Link to comment
Share on other sites

Local $aArraym[2][2][2] = [ [ [1,2] , [3,4] ] , [ [4,5] , [7,8] ] ]

 

Edited by TheXman
Link to comment
Share on other sites

7 minutes ago, TheXman said:
Local $aArraym[2][2][2] = [ [ [1,2] , [3,4] ] , [ [4,5] , [7,8] ] ]

 

You got it!!! Now all work fine thanks!!!

;First Example

Dim $aArray[2][2][2]

$aArray[0][0][0] = 1
$aArray[0][0][1] = 2
$aArray[0][1][0] = 3
$aArray[0][1][1]  = 4

$aArray[1][0][0] = 5
$aArray[1][0][1] = 6
$aArray[1][1][0] = 7
$aArray[1][1][1] = 8


For $a = 0 to 1
    for $b = 0 to 1
        for $c = 0 to 1

ConsoleWrite($aArray[$a][$b][$c] & @CRLF)

        Next
    Next
Next


;Secound Example

Local $aArraym [2][2][2]=[[[1,2],[3,4]],[[5,6],[7,8]]]




For $a = 0 to 1
    for $b = 0 to 1
        for $c = 0 to 1

ConsoleWrite("Here I come " & $aArraym[$a][$b][$c] & @CRLF)

        Next
    Next
Next

 

Link to comment
Share on other sites

Link to comment
Share on other sites

19 minutes ago, Mannyfresh31 said:

You got it!!! Now all work fine thanks!!!

Is not a rant. I don't rant. Well, maybe. :P
If there was a standard to add "[Solved]" to the title would help me not read, it'd also show that the question was 
answered.
...  just a wish of mine :)

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...