Which version of mendix are you using currently?
Because in v9 you can actually configure the loop to be for or while.
If not present
You can create a boolean variable outside the loop and set it to true
Add your logic in the loop and set this boolean to false for your while condition.
Put a check at the start to check the value of this variable
If true it will do the logic
If false put a break event to it
Hope this helps!
Please refer below links for loops
Hope it is useful.