doWhileLoop
Description
Loop runs, and it continues to repeat as long as the condition remains true, executes the loop first then evaluates the condition.
Input / Parameter
condition
The condition to evaluates after the 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 doWhileLoop
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 valuem
onvar
param and add the value0
onvalue
param.Drag the function
doWhileLoop
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 valuem
.Drag the function
setVar
inside functiondoWhileLoop
yes callback, add valuem
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 putm
on it'svar
param value.Drag the function
console
inside functiondoWhileLoop
yes callback, change the param type to subflow/function on paramvalue
. Inside paramvalue
subflow addplus
function then on it'svalue1
param adddo while loop
value, as forvalue2
param change the param type to subflow/function, addgetVar
function in it, then putm
on it'svar
param value.
Result
Now click the button in preview, it will show the list of
do while loop
with the current loop number on the console.
Links
Related Information
See also:
Functions
Last updated