hyTags
HomeHome DocumentationDocumentation

loop-while

Executes a block of commands repeatedly while a condition is true.
Parameter
Type
Description
value
Bool
The boolean condition to evaluate. The loop continues while this is true.
accumulate
Type?
Optional value type to accumulate results from each iteration.
commands
Commands
The commands to execute in each loop iteration.
return
void
No return value.
Test Case:Loop while with break
    <div></div>
    
    <var-set name="count" type="number">
      <number-new value="0">
    </var-set>
    <loop-while value="true">
      <var-update name="count">
        <number-add value="1">
      </var-update>
      <var-get name="count">
      <number-is-equal other="3">
      <if-true>
        <loop-break>
      </if-true>
    </loop-while>
    <var-get name="count">
    <assert-equal value="3" type="number">
    
    👆 Try to change something!
  • Test succeeded Test failed