Loop problem

Slurpee

Newcomer
Joined
Apr 19, 2003
Messages
15
ok a quick question. I hava a nested for loop like say

for x=0 to 10
for y =0 to 10
if some condition is true array (x+1, y-1)=T AND array (x=2, y-2)=T
next y,x

is there a way to increment to counters concurently so that i can get rid of the inner conditiuon (which happens to be a lot more complex) I know you can do this in java and C but in VB i'm not sure. Anyone????
 
hi

for x=0 to 10

for y =0 to 10

if condition = true then
array (x+1, y-1)=T AND array (x=2, y- 2) =T
end if

next y

next x

Like this?

Your question is not so clear, i think.

ByeZ
By
BiZ
 
Squirm was saying that you can change the values of your x and y loop variables inside the loop, to fit your needs, if you really need to change the values (it's generally not a good idea).

If we knew *exactly* what you wanted (change the value of x or y OR change your "if condition = true" logic), we could offer more concrete help.

If you really mean to assign x the value of 2 in the loop, you could write:
Visual Basic:
for x=0 to 10
  for y =0 to 10
    if condition = true then 
      array (x+1, y-1)=T 
      array (x, y- 2) =T
      x = 2
    end if
  next y
next x
or maybe you want:
Visual Basic:
for x=0 to 10
  for y =0 to 10
    if condition = true then 
      array (x+1, y-1)=T 
      x = 2
      array (x, y- 2) =T
    end if
  next y
next x

-Nerseus
 
Back
Top