WHILE

The EASI WHILE command provides a general purpose looping construct.

 WHILE( log_expr )
    statement_list
 ENDWHILE

where

 [log-expr] ..... is a logical expression which is evaluated before
                  each iteration of the loop.
 [statement list] is the list of command statements to execute
                  while the conditions for the loop hold true

The logical expression in the WHILE statement is evaluated and if the result is true, the statement list is executed; otherwise, control skips to the statement following the ENDWHILE. After the statement list has been executed, control returns to the WHILE statement to test the logical expression again.

It is possible to jump into, or out of, the WHILE loop using the GOTO statement. Using GOTO is the convenient way to quit the WHILE cycle in special conditions especially in case of quitting several nested loops on an error. It is not recommended to jump into a WHILE loop since it is implementation dependent and may not work in future versions of EASI.

Example:

The following example prompts the user for a yes or no answer to a question and continues prompting until an acceptable answer is given.

  local string answer
  input "Enter <Yes> to proceed or <No> to abort: " answer

  while( answer != "yes" & answer != "no" )
     input "Please answer either <Yes> or <No>: " answer
  endwhile

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.