Introduction to BASIC
A variable is a location in the computer memory.
A Variable is identified with its name such as a, b, c, ..., x, y, z, a1, a2, a3, etc.
Use a LET statement to assign a value to a variable.
10 LET a=2+3 20 PRINT a-1 30 END
A LET statement calculates the expression on the right side of the equal sign, and assigns it to the variable written on the left side of the equal sign.
For example, the LET Statement in line 20 calculates a+1 and assigns it to a, thus the variable a becomes 11.
10 LET a=10 20 LET a=a+1 30 PRINT a 40 END
One Variable holds only one value at a time. The former value expires when a new value is assigned.
Refer to LET Statement
An INPUT statement enables values to be assigned to variables from the keyboard when the program is on execution.
Two or more variables can be written in an INPUT statement punctuated by commas.
In such a case, the user is to enter the numeric values punctuated by commas when it is executed.
10 INPUT a,b 20 PRINT a+b 30 END
INPUT statements cannot manage numerical expressions excepting constants. For example, input replies such as "SQR(3)" shall raise exceptions.
differences between upper and lower case letters in keywords are ignored.
For example, 'PRINT' can be spelled as 'print', and a variable 'A' can be spelled as 'a'.