Command while

The command while is used to repeat a block of code until a condition is met.

List of operators

  • greaterthan: >
  • lessthan: <
  • greaterthanorequalto: >=
  • lessthanorequalto: <=
  • equalto: =
  • notequalto: !

Logic operations with integer variables

Integer operations are performed the same way as in any other programming language.

Logic operations with string variables

String operations with the operators greaterthan, lessthan, greaterthanorequalto, lessthanorequalto, happen in two stages; firstly the value is converted to a float, and then the logical operation is performed.

String operations with the operators equalto and notequalto are performed the same way as in any other programming language.

Parameters

  1. variable [integer or string]
    Variable that will be used in the comparison.
  2. operator [string]
    Comparison operator: lessthan, greaterthan, equalto, notequalto, greaterthanorequalto or lessthanorequalto.
  3. value [string or integer]
    Value that will be used in the comparison.

Example


The code inside the while block will run 6 times (the variable number has the initial value = 0) displaying the text 'Message'.

The command integeroperator is used to increment (one by one) the value of the variable $(iNumber) on each iteration of the while block until the condition is met, then exits the while block.