If While Loop- Condition=True

Hi Team,

Could someone help me to understand the below activities. I am not getting when the loop ends and come out from while

Thanks in advance

@Ajith3

when the condition is false of if the max iteration value is achevied then it would come out

you gave it as true so it is never false…and max iteration I am not sure if you have set in the properties

cheers

@Ajith3,

This will go in infinite loop means will never come out.

To end the loop you will have to create a Boolean variable and use it as condition. After this inside the body, after your desired number or iterations or condition use assign activity to change the Boolean variable to False.

Once the variable value will be False, you While loop will end.

Refer this Video for more understanding.

Thanks,
Ashok :slight_smile:

1 Like

Hi @Anil_G ,

I have not set max iteration in while loop.

But Parallel is set as True, which means any one of the activity will execute inside parallel activity ?

This flow was developed by my team, i am not sure how loop will end ?

@Ajith3

The loop would not wnd as of now if the max iteration is not set…

Parallel is true means then atleast one should complete but nothing would complete

Cheers

You have hard-coded True in the condition so it will loop forever. You have to use a variable or expression in the condition, such that the process in the body sets the variable to false or the result of the expression becomes false, then the loop ends.

Also, keep in mind that While and Do While are different. While checks the condition first and does not execute at all if it’s false. Do While checks the condition after doing what’s in the body, so even if it’s already false it will still be executed once.

Can You Explain in Brief?