ok, so this is in ActionScript 3, my problem is here:
var numCols:uint = 7;
numRows:uint = 7;
row = 1;
column = 3;
total = row+column-1
for(i = 0; i < numRows; i++){
for(j = 0; j < numCols; j++){
if(j < column){
array[i][j]=total--
}else{
array[i][j]=total++
}
}
}
I am expecting this result in array:
3,2,1,2,3,4....
However I get this:
3,2,1,0,1,2,3,4...
Problem
Your condition
evaluates to
truethree times.the fourth time, the
elseclause gets executed but by this time, yourtotalhas dropped to 0.Possible solution
I don’t know your use case but changing
to
could be all it takes.