Skip to main content
insightsoftware Documentation insightsoftware Documentation
{%article.title%}
Published:
Was this article helpful?
0 out of 0 found this helpful

While... End While

Use this command to repeat a series of instructions until the specified condition is no longer true.

The While command tests the initial condition first. If it equals zero, your system does not carry out the instructions.

Before running the While command, specify the initial value of the variable as zero or non-zero. Somewhere in the loop, change the value of the variable. This process continues until the value of the variable reaches zero.

Copy

Syntax

WHILE <Conditions>
Instructions 
END WHILE                                        

where:

  • Instructions is a set of instructions to be repeated as long as the logical value of the variable is not false (that is, not zero).
  • Conditions are any of the following;

    Value

    Description

    AND

    When each of several conditions must be true.

    OR

    When one of several conditions must be true.

    EQ

    Equal to.

    GE

    Greater than or equal to.

    GT

    Greater than.

    LE

    Less than or equal to.

    LT

    Less than.

    NE

    Not equal to.

Copy

Syntax example

CREATE VARIABLE Loop AS NUM
SET VARIABLE Loop = 1
 
WHILE $Loop$ 
<commands to execute>
SET VARIABLE Loop = $Loop$ + 1
 
IF $Loop$ = 10
SET VARIABLE Loop = 0
END IF
  
END WHILE                                            

See also

Published:

While... End While

Use this command to repeat a series of instructions until the specified condition is no longer true.

The While command tests the initial condition first. If it equals zero, your system does not carry out the instructions.

Before running the While command, specify the initial value of the variable as zero or non-zero. Somewhere in the loop, change the value of the variable. This process continues until the value of the variable reaches zero.

Copy

Syntax

WHILE <Conditions>
Instructions 
END WHILE                                        

where:

  • Instructions is a set of instructions to be repeated as long as the logical value of the variable is not false (that is, not zero).
  • Conditions are any of the following;

    Value

    Description

    AND

    When each of several conditions must be true.

    OR

    When one of several conditions must be true.

    EQ

    Equal to.

    GE

    Greater than or equal to.

    GT

    Greater than.

    LE

    Less than or equal to.

    LT

    Less than.

    NE

    Not equal to.

Copy

Syntax example

CREATE VARIABLE Loop AS NUM
SET VARIABLE Loop = 1
 
WHILE $Loop$ 
<commands to execute>
SET VARIABLE Loop = $Loop$ + 1
 
IF $Loop$ = 10
SET VARIABLE Loop = 0
END IF
  
END WHILE                                            

See also

For an optimal Community experience, Please view on Desktop