Forum Discussion

bgran05's avatar
bgran05
Occasional Contributor
7 years ago
Solved

While loop does not terminate when condition is met, continues

Hi,   I am running  a keyword test with a while loop. I made a minimal instance of a while loop that should terminate when project variable testResult = Fail. Initially, the variable testResult = P...
  • NisHera's avatar
    7 years ago

    In while loop the condition evaluate at the beginning.

    So the first run your conditions (testResult )is pass so it runs in to loop.

    in side loop you set it to fail.

    even condition(testResult ) set it to fail loop is active since no evaluation done.

     

    in second run it evaluate testResult = fails so it dose not go into the loop.

     

    if need to terminate loop immediately you have to have if condition in the loop to brake it.