You might be looking for the Wait Until Keyword Succeeds keyword, which enables you to do a similar construction to a while loop. It is much more readable than FOR cycles with conditional exiting.
You then use your custom keyword, which fails when you need to end the "loop".