[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

(that is, any character spaces NOT taken up by the line number and other required parts of the statement).

A string constant can contain blanks, letters, numbers, punctuation and color or cursor control characters in any combination. You can even put commas between numbers. The only character which cannot be included in a string is the double quote mark ("). This is because the double quote mark is used to define the beginning and end of the string. A string can also have a null value - which means that it can contain no character data. You can leave the ending quote mark off of a string if it's the last item on a line or if it's followed by a colon (:). Some examples of string constants are:

"" ( a null string)
"HELLO"
"$25,000.00"
"NUMBER OF EMPLOYEES"

NOTE: Use CHR$(34) to include quotes (") in strings.

INTEGER, FLOATING-POINT AND STRING VARIABLES

Variables are names that represent data values used in your BASIC statements. The value represented by a variable can be assigned by setting it equal to a constant, or it can be the result of calculations in the program. Variable data, like constants, can be integers, floating-point numbers, or strings. If you refer to a variable name in a program before a value has been assigned, the BASIC Interpreter will automatically create the variable with a value of zero if it's an integer or floating-point number. Or it will create a variable with a null value if you're using strings.

Variable names can be any length but only the first two characters are considered significant in CBM BASIC. This means that all names used for variables must NOT have the same first two characters. Variable names may NOT be the same as BASIC keywords and they may NOT contain keywords in the middle of variable names. Keywords include all BASIC commands, statements, function names and logical operator names. If you accidentally use a keyword in the middle of a variable name, the BASIC error message ?SYNTAX ERROR will show up on your screen.

The characters used to form variable names are the alphabet and the numbers 0-9. The first character of the name must be a letter. Data


[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated December 03, 1998.