LET

BASin

LET

Statement/Command

LET is used to assign a value to a variable. In this version of BASIC, LET cannot be omitted in an assignment statement.

How to use LET

LET normally forms a statement in a program but may be used as a direct command. It is followed by a numeric or string variable, an equals sign, and then a value. The value may be numeric or string, depending on the variable preceding LET, for example

60 LET x=x+1
80 LET a$="Correct"

The value is then assigned to the variable.

Note that simple variables are undefined until assigned values by LET, READ or INPUT. Array variables however are initialised to 0 or a null string ("") by DIM.

Format

  • LET num-var = num-expr
  • LET string-var = num-expr

See also

Chapter 2.