ProtoFlux:While: Difference between revisions

From Resonite Wiki
m add clarification
m Add hint to prefer For-Loops where possible
Line 19: Line 19:
A While node will start running when * is [[Impulses|impulsed]]. The code will continue running and hold a [[Impulses#Context|context]] until the provided Condition is false or the max execution iterations is hit.  
A While node will start running when * is [[Impulses|impulsed]]. The code will continue running and hold a [[Impulses#Context|context]] until the provided Condition is false or the max execution iterations is hit.  
{{Note|If just a [[ProtoFlux:Input|Input]] with the type boolean set to true is provided, the code will not be able to stop and will error the entire Flux chain once max iterations is it, stopping execution.|warning}}
{{Note|If just a [[ProtoFlux:Input|Input]] with the type boolean set to true is provided, the code will not be able to stop and will error the entire Flux chain once max iterations is it, stopping execution.|warning}}
Caution should be exercised when using this node.
Caution should be exercised when using this node. If it is easy to determine how often the loop is going to execute, a [[ProtoFlux:For|For]]-Loop should be preferred to avoid accidentally crashing the game.




[[Category:ProtoFlux:Flow]]
[[Category:ProtoFlux:Flow]]

Revision as of 08:12, 6 February 2024

While
*
LoopStart
Condition
LoopIteration
LoopEnd
Flow


This article or section is a Stub. You can help the Resonite Wiki by expanding it.


A While node will start running when * is impulsed. The code will continue running and hold a context until the provided Condition is false or the max execution iterations is hit.

If just a Input with the type boolean set to true is provided, the code will not be able to stop and will error the entire Flux chain once max iterations is it, stopping execution.

Caution should be exercised when using this node. If it is easy to determine how often the loop is going to execute, a For-Loop should be preferred to avoid accidentally crashing the game.