Syntax, Examples – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual
Page 231
Publication 1746-RM001A-US-P
Input Functions 13-41
Syntax
INPUT
Examples
>INPUT A,C
>INPUT A,C causes a question mark (?) to print on the console device. This
prompts you to input two numbers separated by a comma. If you do not enter
enough data, the module prints
TRY AGAIN
on the console device.
>1
REM EXAMPLE PROGRAM
>10 INPUT A,C
>20 PRINT A,C
>RUN
?1
TRY AGAIN
?1,2
l
2
READY
You can write the INPUT statement so that a descriptive prompt tells you what to
enter. The message printed is placed in quotes after the INPUT statement. If a
comma appears before the first variable on the input list, the question mark prompt
character is not displayed.
>1
REM EXAMPLE PROGRAM
>10 INPUT “ENTER A NUMBER”A
>20 PRINT SQR(A)
>30 END
READY
>RUN
ENTER A NUMBER
?4
2
READY
>
>NEW
>1
REM EXAMPLE PROGRAM
>10 INPUT “ENTER A NUMBER - ”,A
>20 PRINT SQR(A)
>30 END
>RUN