Hardware manual
Impact Reference Guide Commands and Functions I-L
5-17 Datalogic Automation Inc.
Commands and Functions I-L
IF THEN
This command structure provides conditional execution. You can use single or multi-line syntax. If you use
a single line, you cannot include an ELSE statement. (Also see “Loop constructs” on page 5-5)
Example of single line statement:
IF condition THEN code to execute when condition is true
Example of multi-line syntax:
IF condition THEN
Code to execute when
condition is TRUE
ENDIF
You can use an ELSE command to check for a True and False condition.
Example using an ELSE command:
IF condition THEN
Code to execute when
condition is TRUE
ELSE
Code to execute when
condition is FALSE
ENDIF
You can only use one ELSE command. To check for multiple conditions, you can use ELSEIF commands.
You can use as many ELSEIF commands as you want in a conditional statement.
Example using ELSEIF commands:
IF expression1 THEN
Code to execute when expression1 is TRUE
ELSEIF expression2 THEN
Code to execute when expression2 is true
ELSEIF expression3 THEN
Code to execute when expression3 is true
ELSE
Code to execute when expression1, expression2, and expression3 are false
ENDIF
INPUT
See “LINE INPUT” on page 5-20.
INSTR()
The syntax of this function is
INSTR(base_string,sub_string[,position])
The first argument (base_string) is the string to search. The search starts from the beginning of the string.
The second argument (sub_string) is the string to find. The third argument is the character location to start
the search. The location of the first character of sub_string is returned. If the position argument is missing,
the search starts with the first character of base_string. Undef is returned if the sub_string is not found.
Example:
location_int = INSTR ("bases","ase",1) yields location_int = 2
INSTRREV()