beautypg.com

Rpbasic-52 programming guide, Input – Remote Processing BASIC 52 User Manual

Page 67

background image

RPBASIC-52 PROGRAMMING GUIDE

2-48

INPUT

Syntax:

INPUT ["prompt text"] [,] [,variable ...]
Where: prompt text = optional text

variable = list of variables to assign

Function:

Program p auses to receive data entered from the console inpu t.

Mode:

Run

Use:

100 INPUT "Enter batch number",$(0)

Cards:

All

D E S C R IP T I ON

INPUT brings in numeric and string data from the console serial port during execution. Variables are string,
numeric, or bo th. Variables are se parated by a c omm a. Optional prompt text must be enc losed i n quot es.

When an optional com ma prece des the first variable, the question mark prompt character is suppressed and
data entry is on the same line as prompt text.

Multiple numeric data may be entered by separating individual values with commas and using on the
last on e. Or, ea ch dat a entry may be ent ered u sing a < cr>.

Strings must be entered with a carriage return.

If you do not enter enough data or the correct type, Basic sends the message TRY AG AIN and prompt text
after which yo u must ente r all t h e d a ta . If y ou e n te r to o m a ny c h ar a ct e rs f or t he s iz e o f a l lo c a te d S T R IN G
memory, or more numeric values than were requested, Basic discards the extra data, emits the message
EXTRA IGNORE D, and continues execution.

There are tw o major differen ces betwe en RPB ASIC-5 2 and BA SIC-52 w hile using INP UT. Input ch aracters
are buffered. The operator or device may "type ahead" into the buffer and INPUT will respond just that much
quick er. The back- space chara cter (A SCII v alue 0 8) is rec ogniz ed in th e sam e wa y as the delete key w as.
This ma kes editing progra ms m ore convenie nt.

RELATED

C O M $ , G E T , S T R I N G

ERRORS

none

EXAMPLE

10 STRING 200,20
20 INPUT "Enter a number, string, and 2 more numbers: ",A,$(0),B,C
30 PRINT "String:",$(0)
40 PRINT "Numbers:",A,B,C

>run

Enter a number, string, and 2 more numbers: 4,Bob
?7,9
String:Bob
4 7 9