Skip a while loop if the condition is not met at the start

Hi, I have a while loop that has the condition “while A=True”. Now I would like that if the process comes to the while loop and A=False it should do nothing within the loop (skip instead of doing once). How could I achieve that? It is within a longer sequence so I would like to avoid changing the structure completely. An if statement over the whole loop is also not readable.Thanks for suggestions

1 Like

The While A=True will execute the loop while the condition is true. Otherwise, it will skip the loop.

2 Likes

While(A=True):
Statement1;
Statement2;
.
.
Statementn;

2 Likes

Okay, so the while loop ends immediately without doing the whole process once. Thanks

1 Like

The Do While loop is different. It will execute first the loop conditions, and then will check if the condtion is true or not.

The While loop checks first if the condition is true or not, and then will execute the body depending on your condition.

2 Likes

Okay, thanks a lot. That’s what I was confused about.
My second question would be if there is something like a “break” activity for the while loop.

1 Like

This answer your question

Break_error

1 Like

So there is no workaround here?

1 Like

I am not sure, but i think there is no way to break a loop. You can do a break by throwing it to an exeption with a Throw activity.

2 Likes

Well, would have been a nice freature. Thanks for the information.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.