IF

The IF statement is used to conditionally execute statements.

 IF( logical_expression )THEN
    statement_list
 [ELSEIF( logical_expression )THEN
    statement_list]
 [ELSE
    statement_list]
 ENDIF

 logical_expr  - A logical expression as described
                 in the Logical Expression topic.
 statement_list        - A list of one or more statements.

Each logical_expression is evaluated in turn until one of them evaluates to be true. When one is true, the corresponding statement_list will be executed, and control will continue beyond the ENDIF. If none of the logical expressions is true and an ELSE clause exists, the associated statement_list will be executed.

Example:

local string  response
PromptAgain: response=""
print "Have a nice day, Paul! Do you wish to repeat? (Y/N)"
while(response = "")
    response = GetAsyncChar()
    call Sleep( 0.1 )
endwhile
if( response = "N" ) then
    goto go2Exit
  elseif( response = "Y" ) then
    goto PromptAgain
  else
    print "A wrong button was pressed: "+response
endif
go2Exit: print "Quitting.."
call AsyncDisable()

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