Conditionally executes a group of statements, depending on the value of an expression. (Standalone only)


Applies to: CMD-4CR, CMD-4EX-SA


Standalone        IF

       ELSEIF

ELSE

ENDIF

Syntax        

               

Write

IF [condition]

[statement] 

       ELSEIF [elseifcondition]

[elseifstatement] 

ELSE

  [elsestatement] 

ENDIF                 

[condition] Required. Expression. Must evaluate to True or False using a relational operator.

[statement]   One or more statements to be executed if [condition] is TRUE 

[elseifcondition] Required if ELSEIF is present Expression. Must evaluate to True or False using a relational operator.

[elseifstatement] One or more statements to be executed if [elseifcondition] is TRUE

[elsestatement]     One or more statements that are executed if no previous [condition] or [elseifcondition] expression evaluates to True.


Reply 

Command is accepted and executed


No Reply


Example 

Write        

IF IO4=1                 * If configurable IO 4 is on.

  X1000                 * Move to 1000 (for X-axis)

  WAITX                 * Wait for X-axis move to complete

ELSEIF IO5=1        * If configurable IO 5 is on

  X2000                 * Move to 2000 (for X-axis)

  WAITX                 * Wait for X-axis move to complete

ENDIF                 * End of IF loop


Notes

None