Statement: input – Rockwell Automation 1771-DB Basic Module User Manual - Series A User Manual
Page 63

Operating Functions
Chapter 5
5–26
Upon execution
of line 10 IF A is equal to 100, THEN A is assigned a
value of 0. IF A does not equal 100, A is
assigned a value of A+1. If you
want to
transfer control to different line numbers using the IF
statement, you may omit
the GOTO statement. The following examples
give
the same results:
u20 IF INT(A) t10 THEN GOTO 100 ELSE GOTO 200
or
u20 IF INT(A) t10 THEN 100 ELSE 200
You can replace
the THEN statement with any valid BASIC Module
statement, as shown below:
u30 IF Atu 10 THEN PRINT A ELSE 10
u30 IF Atu 10 PRINT A ELSE 10
You may execute
multiple statements following the THEN or ELSE
if
you use a colon to separate them.
Example:
u30 IF Atu 10 THEN PRINT A:GOTO 150 ELSE 10
u30 IF Atu 10 PRINT A:GOTO 150 ELSE 10
In these examples,
if A does not equal 10 then both PRINT A and
GOTO 150
are executed. If A10, then control passes to 10.
You may omit the ELSE statement. If you omit the ELSE statement control
passes to the next statement.
Example:
u20 IF A10 THEN 40
u30 PRINT A
In this example, if A equals
10 then control passes to line number 40. If
A does not equal 10 line
number 30 is executed.
Mode: RUN
Type:
INPUT/OUTPUT
The INPUT statement allows you to enter data from the console during
program
execution. You may assign data to one or more variables with a
single
input statement. You must separate the variables with a
comma.
Example:
uINPUT A,B
5.4.15
Statements: IF – THEN –
ELSE (continued)
5.4.16
Statement: INPUT