$IF without frequency

The instruction block is executed exactly when the condition is true.

Programming Example

$IF with multiple branches

; Define realtime cycle
#RT CYCLE [SCOPE = PROG]
  ; Query value of external variable
  $IF V.E.VALUE > 0
    ; Increment positive counter
    V.E.COUNT_POS += 1
  $ELSEIF V.E.VALUE < 0
    ; Increment negative counter
    V.E.COUNT_NEG += 1
  $ELSE
    ; Increment zero counter
    V.E.COUNT_NULL += 1
  $ENDIF
#RT CYCLE END