whileLoop
Description
Loop runs, and it continues to repeat as long as the condition remains true, it evaluates the condition first before looping.
Input / Parameter
condition
The condition to evaluates first before loop
boolean
-
-
Yes
Output
N/A
Callback
yesCallback
This will be triggered for every loop that happens while the condition remains true.
Example
In this example, we will do console logging by using console
function in whileLoop
callback
Code Equivalent
Steps
Drag a
button
component into the canvas and open theAction
tab. Select thepress
event of the button and drag thesetVar
function to the event flow, add the valuen
onvar
param and add the value0
onvalue
param.Drag the function
whileLoop
to the eventflow, on it'scondition
param change the param type to function/subflow then add functionless
inside the subflow, for thevalue1
param change the param type to function/subflow then add functiongetVar
inside the subflow, for thevar
param add valuen
.Drag the function
setVar
inside functionwhileLoop
yes callback, add valuen
on paramvar
and change the param type to subflow/function on paramvalue
. Inside paramvalue
subflow addadd
function then on it'svalue1
change the param type to subflow/function, addgetVar
function in it, then putn
on it'svar
param value.Drag the function
console
inside functionwhileLoop
yes callback, change the param type to subflow/function on paramvalue
. Inside paramvalue
subflow addplus
function then on it'svalue1
param addwhile loop
value, as forvalue2
param change the param type to subflow/function, addgetVar
function in it, then putn
on it'svar
param value.
Result
Now click the button in preview, it will show the list of
while loop
with the current loop number on the console.
Links
Related Information
See also:
Functions
Last updated