Parker
Hannifin
ELSEIF Condition
The
IF/ELSE
statement can include the
ELSEIF
condition. The
ELSEIF
condition lets you create a series of circumstances to test. There is
no practical limit to the number of
ELSEIF
conditions you can
include. However, they must come before the
ELSE
condition.
Here is how it works. When the
IF
condition is true, the subsequent
statements are executed. When the
IF
condition is false, each
ELSEIF
statement is tested in order. When an
ELSEIF
condition tests true, the
subsequent statements are executed. When the
ELSEIF
condition test
false, the statements following
ELSE
condition execute. After
executing the statements following an
IF
,
ELSEIF
, or
ELSE
, the
program moves past the
ENDIF
to continue program execution.
When using the
ELSEIF
condition, you can omit the
ELSE
condition.
When the
IF
and
ELSEIF
conditions test false, statement execution
after the
ENDIF
continues. Think of it as creating a series of
IF/THEN
statements.
GOSUB
The
GOSUB
branches to a subroutine and returns when complete.
You can use
GOSUB
and
RETURN
anywhere in a program, but both
must be in the same program. A procedure can contain multiple
RETURN
statements. However, on encountering the first
RETURN
statement, the program execution branches to the statement
directly following the most recently executed
GOSUB
statement.
Example
The following example demonstrates a simple
GOSUB
routine.
GOSUB Label1
…
_Label1
PRINT “Inside Label1 subroutine”
RETURN
GOTO
The
GOTO
statement provides an unconditional branch within a
procedure. You can only use the
GOTO
in the procedure in which it
appears.
You can nest
GOTO
statements in an
IF/THEN
statement.
NOTE:
The
GOTO
statement makes code difficult to read and
maintain.
Programming Basics 21
Содержание ACR Series
Страница 1: ......
Страница 65: ...Parker Hannifin Making Motion 65...
Страница 89: ...Parker Hannifin Servo Loop Fundamentals 89 Figure 17 Following Error...