Android Question Do while/until with test at the end of the loop?

wimpie3

Well-Known Member
Licensed User
Longtime User
Maybe I'm overlooking something... We currently have

B4X:
Do while condition=true
(my code)
loop

or

B4X:
Do until condition=true
(my code)
loop

But they all test the condition BEFORE beginning the loop. Is there a way to do this right before reaching the end of the loop? Like

B4X:
Do
(my code)
Until condition=true
 

DonManfred

Expert
Licensed User
Longtime User
But they all test the condition BEFORE beginning the loop. Is there a way to do this right before reaching the end of the loop? Like
Do until condition=true (my code) loop:
Do until condition=true
(my code)
loop
will WORK if you set condition to true before the loop-line!!!
 
Upvote 0

wimpie3

Well-Known Member
Licensed User
Longtime User
Yes, in this particular case. But your suggestion does not work when I'm moving the pointer in a recordset with .nextrow.

I want something like this:
Do
(my code)
Until not(recordset.nextrow)

This moves the recordpointer AFTER my code has been executed.

When I do this:
Do until not(recordset.nextrow)
(my code)
Loop

the record pointer is already moved forward BEFORE it reaches my code.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
What does (my code) do? doesn't it handle recordsets?
 
Last edited:
Upvote 0
Top