5.10 Assignment Statements
The following statements assign values to variables:
.
LET
.
INPUT
.
LINPUT
.
INPUT LINE
LET and INPUT statements allow you to assign values to
any type of variable, while LINPUT and INPUT LINE allow
you to assign values to string variables. For example:
LET A = 1.25
LET is an optional keyword. You can assign a value to more
than one variable at a time, although this is not recom-
mended. Instead, use a separate assignment statement each
time you assign a value to a variable.
Whenever you assign a value to a numeric variable, BASIC
converts the value to the data type of the variable. If you
assign a floating-point value to an integer variable, BASIC
truncates the value at the decimal point. If you assign an in-
teger value to a floating-point variable, BASIC converts the
value to floating-point format.
You can also assign values to variables with the DATA
and READ statements; however, this method requires that
you know all input data values while you are coding your
program.
The INPUT, LINPUT, and INPUT LINE statements all as-
sign values in the context of data being read into the program.
These statements are discussed in Chapter 6.