Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 232

Advertising
background image

Publication 1746-RM001A-US-P

13-42 Input Functions

ENTER A NUMBER - 25

5

READY

>

You can also assign strings with an INPUT statement. Strings are always
terminated with a carriage return (cr). If more than one string input is requested
with a single INPUT statement, the module prompts you with a question mark.

>1 REM EXAMPLE PROGRAM

>10 STRING 100,20

>20 INPUT “NAME(CR),AGE - ”,$(1),A

>30 PRINT “HELLO ”,$(1), “YOU ARE ”,A,“ YEARS OLD.”

>40 END

READY

>RUN

NAME(CR),AGE - PAM

?29

HELLO PAM YOU ARE 29 YEARS OLD.

READY

>

You can assign strings and variables with a single INPUT statement.

>1

REM EXAMPLE PROGRAM

>10 STRING 100,10

>20 INPUT “NAME(CR), AGE - ”,$(1),A

>30 PRINT “HELLO ”,$(1),“, YOU ARE ”, A,“ YEARS OLD”

>40 END

>RUN

NAME(CR),AGE - FRED

?15

HELLO FRED, YOU ARE 15 YEARS OLD

READY

>

Advertising