# Boolen to int conversion

i want to use boolean as condition to incriment the dowhile loop is it possible ?

existss is either true or false so you donâ€™t need â€ś=trueâ€ť

I also donâ€™t understand your question. If you want to use it to loop your Do While, then you can do so how you are currently by putting the boolean in the condition of the Do While.

``````Do

Element Exists
While existss
``````

It will loop until the element is no longer on the screen.

hey hi clayton, i want to repeat the next button click action until the element exist gives true value , so i want a loop for this could you please explain me how to do this?, thank you

Hi.

If you want to loop until the element exists, then you want the opposite. So, it reads as Do While exissts is false
You just need to use â€śnotâ€ť infront to make it the opposite of true, like not existss

``````Do

While not existss
``````

Regards

Itâ€™s best practice to put a limit on the number of loops the robot will attempt, otherwise it will get stuck in the loop forever. For this you could have an integer variable, assign it as 0 before you enter the do while loop, and then in the body of the do while insert an assign which increases the integer variable by 1 each time. Something like;

IntegerVar = IntegerVar+1

In the condition of your do while you would then add where IntegerVar is less than, say, 5.

existss=FALSE AND IntegerVar<5

Remember that your condition of the do while should be TRUE for it to loop, otherwise the robot will continue with the workflow. If existss=true (so your element exists) or the counter gets to 5, it will continue. You could then check once more if your element exists, and if not, throw an error.

1 Like

@KEntwistle Good point! Retry Scope is a good approach to avoid infinite loops as well; you can use the Element Exists (since it returns a boolean) in the condition spot of the Retry Scope.