using for/next
Blitz3D Forums/Blitz3D Programming/using for/next
| ||
| If I have 9 arrays called row1, row2, row3 etc. Does anybody know how I can just use 1 simple for next loop to read the elements like:
for a = 0 to 9
for b = 0 to 9
read row(a)(b)
next
next
I have tried a few different ways but nothing I can figure works! ;}-Rook |
| ||
It's late but would this not work?
for a = 0 to 9
read row(a)(a)
next
|
| ||
| Instead of having 9 arrays, you should have 1 2-dimensional array Dim myarray(9,9) Otherwise, you'll have to have 9 loops for each row (row1, row2, etc) |
| ||
| GNS it tells me that ROW is not a function. Soja... I had an 2D array but it was easier to check for 3 in a row by comparing arrays 1D. I may go back to 2D since I can't get it to work well... -Rook |
| ||
| I had an 2D array but it was easier to check for 3 in a row by comparing arrays 1D Compare 3 Dim Array(3,9)
;set up some test values - these could be anything
Reel1 = 4 ;position 4 on reel 1
Reel2 = 7 ;position 7 on reel 2
Reel3 = 2 ;position 2 on reel 3
;compare three reels
If Array(1, Reel1) = Array(2, Reel2)
If Array(2, Reel2) = Array(3, Reel3)
;all three are the same
EndIf
EndIf
Is this what you mean? |
| ||
| Yes Wolron... yessir!!! -Rook |