23
Constants
Character
Numeric
Integer
Decimal
Octal
Hexadecimal
Real Number
Single-precision
Double-precision
A character constant is a character string enclosed by double quotation marks
(”). It can be up to 255 characters long. If it has no character, it is called an “empty
character string” or a null string.
Example:
“CF-BASIC”
Whole numbers between –32768 and 32767 can be used. An optional percent
sign (%) can be added to specifically indicate an integer constant. Integer con-
stants do not have decimal points.
Examples:
1234 –1234 12
Octal Constants
Octal numbers from 0 to 7 beginning with the prefix “&” and within the range of &0
to &177777 can be used.
Examples:
&0127 &7777
Hexadecimal numbers with the prefix “&H”, from 0 to F (0 to 9,A,B,C,D,E,F) and
in the range &H0000 to &HFFFF can be used.
Examples:
&H5E &HBF4
Single precision: This type of constant is stored with seven-digit precision and is
output as a six-digit constant with the seventh digit rounded off. It is represented
by one of the following methods:
1, 2, 3...
1. As a number with seven or less digits: 1234.5
2. As a number in exponential form using E: 1.2E+3
3. As a number with the character “!” at the end: 2.34!
Double precision: This type of constant is stored with 16-digit precision and is
output as 16 digits or less. It is represented by one of the following methods:
1, 2, 3...
1. As a number with 8 or more valid digits: 1.23456789
2. As a number in exponential form using D: –1.2D–3
3. As a number with the character “#” at the end: 2.34#
Variables
Variables are names used to represent values that are used in a BASIC pro-
gram. The value of a variable may be assigned as the result of calculations or
explicitly by the programmer with an assignment statement. If no value is as-
signed to a numeric variable, it is assumed to be zero. If no value is assigned to a
character variable, it is assumed to be a null string.
Variable Name
A variable may be up to 255 alphanumeric characters long, but only the first 16
characters are actually valid. No variable can start with “FN” or a valid BASIC
command name.
Note A syntax error will occur if a variable begins with a reserved word (i.e., in the case
of TOTAL or ABSOL, a syntax error will occur because TO and ABS are reserved
words).
Type Declarator
The variable TYPE must be declared. This is done using a type declarator which
is placed after the variable name. Even if two variables have the same name,
they will be treated differently if they are declared as different types of variables.
Integer: Uses 2 bytes per variable.
Character Constants
Integers Constants
Hexadecimal
Constants
Floating Point
Constants
Program Configuration
Summary of Contents for C500-ASC04
Page 1: ...C500 ASC04 ASCII Unit Operation Manual Revised February 2001 ...
Page 5: ...iv ...
Page 7: ...vi ...