While Wend cycle

Hi,

I don’t understand why this loop exits immediately on the first turn and doesn’t wait for the value to be equal to 4.

mycount=1
while mycount < 4

IF Mycondition then
messagebox(“Mycondition verified !”)
gestione1.ShowModal
else
messagebox(“Mycondition NOT verified !”)
mycount = mycount + 1
end if

wend

messagebox(“The OTP verification attempt limit has been exceeded. The procedure will be closed.”)
self.close

Thanks

Your code is correctly executed; mycount is less than 4… because it is 1.

Hi Emile,

he actually goes around three times and then comes out. I misinterpreted it.
Thanks

Longtime ago, I had troubles with Less Than (<) and Greater Than (>); a friend helped me and the troubles goes away since then. :wink:
But sometimes I made errors with Boolean; I do not try to understand, I swap the code and it works !

I would have expected something more like this:

Ask for an OTP.

If it is incorrect, ask again. keep asking until 4 tries

Then decide if the right answer or 4 tries happened first

(I am assuming that gestione1.ShowModal is where how check the MyCondition)