Almost done, just needs clarification on inclusive or exclusive. |
link async |
||
(3 intermediate revisions by the same user not shown) | |||
Line 18: | Line 18: | ||
|}} | |}} | ||
The '''Range Loop Int''' node is used to perform looping operations by allowing one to define a range of values and step size for iterations to follow. It is a more flexible version of the [[ProtoFlux:For|For]] node. | |||
Range Loop Int is a | |||
== Inputs == | == Inputs == | ||
Line 26: | Line 24: | ||
=== * ([[Type:Int|int]]) === | === * ([[Type:Int|int]]) === | ||
Begin the range loop. | |||
=== Start ([[Type:Int|int]]) === | === Start ([[Type:Int|int]]) === | ||
The number to start at | The number for <code>Current</code> to start at during execution. | ||
=== End ([[Type:Int|int]]) === | === End ([[Type:Int|int]]) === | ||
The number to | The number for <code>Current</code> to iterate towards and compare to during execution. This input is inclusive. | ||
=== StepSize ([[Type:Int|int]]) === | |||
The value that is added or subtracted to <code>Current</code> per iteration for the current <code>LoopIteration</code>. The loop will either add or subtract this value depending on whether <code>Start</code> is less than or greater than <code>End</code>. There will be no iterations if this value is less than <code>1</code>. | |||
{{Note|As of the time of writing, [https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/3350 this node does not account for overflow or underflow when evaluating the loop range]. To avoid this issue, make sure that <code>2147483647 - End <nowiki>>=</nowiki> StepSize</code> when going forwards or <code>2147483648 + End <nowiki>>=</nowiki> StepSize</code> when going backwards.|warning}} | |||
== Outputs == | == Outputs == | ||
Line 46: | Line 44: | ||
=== LoopStart ([[Impulses|Call]]) === | === LoopStart ([[Impulses|Call]]) === | ||
Fires | Fires after <code>*</code> is pulsed and before any iterations are done. Will be pulsed even if <code>StepSize < 1</code>. | ||
=== LoopIteration ([[Impulses|Call]]) === | === LoopIteration ([[Impulses|Call]]) === | ||
Fires | Fires for each iteration of the loop. This impulse is triggered until <code>Current</code> exceeds <code>End</code> in the direction of the loop, at which point the iterations will stop. | ||
=== LoopEnd ([[Impulses|Continuation]]) === | === LoopEnd ([[Impulses|Continuation]]) === | ||
Line 60: | Line 56: | ||
=== Current ([[Type:Int|int]]) === | === Current ([[Type:Int|int]]) === | ||
This value will start at <code>Start</code> for the first iteration, then at each iteration, this value will either increase or decrease by <code>StepSize</code> depending on whether <code>End</code> is greater than or less than <code>Start</code>. This value lasts for said iteration's entire [[context]]. | |||
== Examples == | == Examples == | ||
== See Also == | |||
* [[ProtoFlux:Async Range Loop Int]] for the [[async]] variant of this node. | |||
[[Category:ProtoFlux:Flow]] | [[Category:ProtoFlux:Flow]] |
Latest revision as of 19:15, 15 December 2024
The Range Loop Int node is used to perform looping operations by allowing one to define a range of values and step size for iterations to follow. It is a more flexible version of the For node.
Inputs
* (int)
Begin the range loop.
Start (int)
The number for Current
to start at during execution.
End (int)
The number for Current
to iterate towards and compare to during execution. This input is inclusive.
StepSize (int)
The value that is added or subtracted to Current
per iteration for the current LoopIteration
. The loop will either add or subtract this value depending on whether Start
is less than or greater than End
. There will be no iterations if this value is less than 1
.
Outputs
LoopStart (Call)
Fires after *
is pulsed and before any iterations are done. Will be pulsed even if StepSize < 1
.
LoopIteration (Call)
Fires for each iteration of the loop. This impulse is triggered until Current
exceeds End
in the direction of the loop, at which point the iterations will stop.
LoopEnd (Continuation)
Fires once the loop has finished.
Current (int)
This value will start at Start
for the first iteration, then at each iteration, this value will either increase or decrease by StepSize
depending on whether End
is greater than or less than Start
. This value lasts for said iteration's entire context.
Examples
See Also
- ProtoFlux:Async Range Loop Int for the async variant of this node.