Problem "while"

Hello, I have a problem with the while function, I tell it a simple calculation, as long as the difference is greater than or equal to 0,

My problem is that the program runs and nothing happens, when I disable the while, the program terminates very quickly, do you think my steps are incorrect

Hello,

This is what’s happening:

  1. Steps run sequentially
  2. You first make Set Value difference
  3. You then enter the While loop
  4. Notice you never again Set Value difference, so the value of difference always stays the same (that Set Value is before the While loop, so it doesn’t repeat like whatever is inside the While)
  5. The While loop runs infinitely because you never update the variable difference

Also note you may need to use the “Global” property of the Set Value

3 Likes

Thanks Apple

Under which step should I put incrementJour+7?

Morgan

@Apple
Hi Apple,
the variable difference is updated by incrementJour+7 no?

Hi Morgan,

Add another Set Value difference (Global name of the initial Set Value difference) step after the Set Value incrementJour step in the while loop. This will update the value of difference when each loop has finished running all the API actions, and exit the loop when the difference within the loop is calculated as >= 0. Otherwise it will run infinitely as mentioned by Apple.

1 Like

Thanks i will try