Do while limitations

gjoisa

Active Member
Licensed User
Longtime User
This code works
B4X:
        Dim c as Int
        c = 1
   Do While c < 11
      b = c * 4
      c = c + 1
      Msgbox(b,"")
   Loop
But this doesn't work
B4X:
Dim c as Int
        c = 1
   Do While c + 10
      b = c * 4
      c = c + 1
      Msgbox(b,"")
   Loop
and also this Doesn't work
B4X:
Dim c as Int
        c = 1
   Do While c > 9
      b = c * 4
      c = c + 1
      Msgbox(b,"")
   Loop
Why this limitation ?
 

Jost aus Soest

Active Member
Licensed User
Longtime User
What do you mean with "doesn't work"?

Your second example contains wrong syntax, as the while condition needs a boolean (and not an int).

In your third example the while condition negates, so that the loop will never run.
 
Upvote 0

gjoisa

Active Member
Licensed User
Longtime User
In my second example the code should be
B4X:
Do While c = 10
but this code doesnot work .
 
Upvote 0
Top