Skip to main content
Untitled Document

FOREVER

FOREVER

FOREVER

Syntax:

          FOREVER LOOP
             statement_block
             [ EXIT LOOP ]
          END LOOP

statement_block is executed forever unless [EXIT LOOP] is encountered, in which case the loop is immediately terminated. This is commonly used for the main loop in a program because an embedded program like this never ends.

Example:

          xx = 5
          yy = 6
          FOREVER LOOP
             READ_ADC()
             CHANGE_SPEED()
             IF (speed == 5) THEN
                EXIT LOOP
             END IF
          END LOOP