(Redirected from While (ProtoFlux))
While
Flow
The While node will start running when this gets impulsed. The code will continue running and hold a context until the provided Condition is false or the max execution iterations is hit.
Inputs
* (Call)
Impulse to start the loop
Condition (Boolean)
The value that the loop will check for if it should continue running or not.
Outputs
LoopStart (Impulse)
Fires once at the beginning of the loop, regardless of if Condition (Boolean) is true or not.
LoopIteration (Impulse)
Fires infinitely all in one game tick until the game crashes, or Condition (Boolean) is false. Will only fire if Condition (Boolean) is true.
LoopEnd (Impulse)
Fires once the triggered loop has ended and the node has not hit a critical error.
Examples
-
Example of how to use a while loop.
-
Example of how to not use a while loop, which will crash the game if fired.
Further Reading
Fun Facts
This node (and even more broadly, code with loops like these in general) has an Unsolvable Problem, specifically the halting problem.