While
Flow
The While node is used to perform looping operations by allowing one to fire impulses continuously while a condition remains true.
For the async variant of this node, see Async While.
Inputs
* (Call)
Begin the while loop.
Condition (Boolean)
Condition that the loop will check to determine if it should iterate again or not. If True
, it will iterate again.
Outputs
LoopStart (Impulse)
Fires after *
is pulsed and before any iterations are performed. Will be pulsed even if Condition
is False
at the time of the loop beginning.
LoopIteration (Impulse)
Will be pulsed for as long Condition
is True
. Only after the context of the current loop iteration is finished will the next iteration fire.
LoopEnd (Impulse)
Fires after Condition
turns False
, continuing the impulse chain from before.
Known Issues
- As of the time of writing, there is a known issue where if the final node in the
LoopIteration
chain is a Write node, said node modifies a variable used for conditional evaluation, and the value to write is based off said variable, the write will be using a previously cached value. This can cause an extra loop iteration to occur, which is very annoying to debug.- The easiest way to work around this bug is to add a "dummy" node after the write, such as an Impulse Display or, if debugging a ton of impulses and lag is undesirable, an empty Write node.
See Also
- If it is possible to determine the amount of times you need to loop beforehand, consider ProtoFlux:For instead.