You can also use variables as expressions.
rate = 50time = 2
distance = rate * time
PRINT distance
Output:
100
Plus, you can have both variables and numbers in an expression.
X = 100
Y = X * 7
PRINT Y
Output:
700
TIP: The following increases X by 1:
X = X + 1
Strings
If you add a dollar sign ($) to the end of a variable, the variable is a string.
X$ = "Hello World!"
PRINT X$
Output:
Hello World!
If you try to set a string to a non-string variable, an error occurs.
X = "Hello World!"
The QBasic interpreter says "Type mismatch" when you try to run the above program.