Variable Name
A variable name starts with a (unshifted) letter, optionally followed by one or more (unshifted) letters or numerals. The length of the name is unlimited, but only the first two characters are significant. The resulting name must not be (or contain as a substring) any BASIC token.
By default, a variable name refers to a floating-point number. A name followed with a dollar sign ($) specifies a string variable, and a name followed by a percent sign (%) specifies an integer number. A name preceded with the FN keyword specifies a custom function.
Each different type of variable which otherwise has the same name is unique; this also applies to arrays which are identified by a set of parentheses after the name (see first example below).
The above statments refer to user variables. BASIC also maintains a few reserved variables. These may used in a read-only manner, but generally may not be assigned a value (the exception being TI$).
Examples
The following names are all valid and unique (X is a dummy value, it could be any numeric expression in practice).
A A% A$ FN A(X) A(X) A%(X) A$(X)
The following names are all valid, but they all refer to the same variable.
ALBATROS ALLY ALL7S AL
The following names are not valid because they contain keywords:
COST SINK TANK POST
This page is a member of Commodore BASIC