While

Verb: while

Repeats a command block while a condition is true.

Syntax

while --left(Variant) --operator(ConditionalOperators) --right(Variant) [--negate(Boolean)]

Inputs

Script Designer Required AcceptedTypes Description
--left Left operand Required Any Value used to evaluate the condition.
--operator Operator Required ConditionalOperators Rule used to evaluate the condition. Options:
  • Begins with
  • Contains
  • Ends with
  • Equal to
  • Greater than
  • Greater than or equal to
  • Is empty
  • Is null
  • Is null or empty
  • Is true
  • Less than
  • Less than or equal to
  • Matches
  • --right Right operand Only whenOperator is Equal_To, Greater_Than, Greater_Than_Equal_To, Less_Than, Less_Than_Equal_To, Contains, Ends_With, Begins_With, Matches Any Value used to evaluate the condition, along with Left operand and Operator.
  • Value must be of the same type as Left operand.
  • --negate Negate Optional Boolean Negates the rule defined in Operator.

    Example

    Example 1: The While command repeats a command block, incrementing a variable's value by 1 while this value is less than 5.

    defVar --name verifyValue --type Numeric
    while --left "${verifyValue}" --operator "Less_Than" --right 5
    	incrementVar --number ${verifyValue}
    	logMessage --message "${verifyValue}" --type "Info"
    endWhile
    // Result of operation:
    // 1
    // 2 
    // 3
    // 4
    // 5
    

    Example 2: In this other situation, when using the Negate parameter, the instruction block is repeated, decreasing the verified value by 1, while this value is not less than 5.

    // The value to be verified is equal to 8.
    defVar --name verifiedValue --type Numeric --value 8
    while --left "${verifiedValue}" --operator "Less_Than" --right 5 --negate
    	logMessage --message "${verifiedValue}" --type "Info"
    	decrementVar --number ${verifiedValue}
    endWhile
    // Result of the operation:
    // 8
    // 7
    // 6
    // 5
    

    Remarks

    When using the While command, the use of the End While command is mandatory to end the command block.

    See Also

  • Assert Condition
  • Assign Value to a Variable If
  • Begin Do-While
  • Case
  • Continue
  • Else
  • Else If
  • End Case
  • End Do-While
  • End For Each
  • End If
  • End While
  • Execute Subroutines
  • For
  • For Each
  • Go to
  • Go to If
  • If
  • Insert Label
  • Interrupt Loop
  • Next
  • Otherwise
  • Return from Subroutine
  • Run Subroutine
  • Run Subroutine If
  • Then
  • When