BASIC-SO
Language Elements
Functions
Functions are built-in routines that return a value based on the argument or
arguments supplied. They can be used to form expressions with either commands
or
statements.
BASIC-SO
includes both numeric and string functions.
Table
2-3
lists the
BASIC-SO
functions. In addition to these, up to
10
user-written
functions can be defined with the DEFFN statement.
Representing Data
The instructions described in the previous topics tell BASIC-80 what to do; to carry
out these instructions, you must also provide data in a specific fashion. Intel
BASIC-80 includes constant and variable values, in either numeric or string format;
allows these values to be grouped into arrays; provides for conversion from one data
type to another; and allows these values to be combined into expressions using
arithmetic, relational, and logical operators.
Syntax
BASIC-SO
accepts instructions and data in a specific format. This format, called
syntax, must be followed to obtain useful, predictable results.
BASIC-SO
syntax
is
a
superset
of
ANSI Minimal BASIC syntax. The table below describes the meta-
language elements used to illustrate
BASIC-80 syntax.
Table 2-4. BASIC-80 Metalanguage Elements
Condition
Example
An
instruction that requires no argument is
RESTORE
shown by itself in uppercase letters.
If
an
argument must be provided, the descrip-
GOTOline
tion
of
the argument, in lowercase letters,
POKE
address, value
follows the instruction.
If
an
argument is optional, the description of
RESUME
[line number]
the argument is enclosed in brackets.
SAVE
"filename"
[,A]
If more than one type of argument can be
PRINT
expressionlvariable
specified, the choices are separated by ver-
tical lines.
If
an
argument can be repeated, three dots
READ
data [,data] ...
signify repetition.
ON
variable GOSUB line [,line] ...
Numeric Data
BASIC-SO
accepts numeric values as either constants or variables. Within these two
categories, there are three types
of
representation: integer, single-precision floating-
point, and double-precision floating-point.
Using the DEFINT, DEFSNG, or DEFDBL statements, you can define a range of
letters to signify integer, single-precision floating-point, or double-precision
floating-point numeric variables.
If
you
don't
define numeric type, you can specify
it with a one-character suffix when you use the variable or constant letter name.
If
you
don't
specify numeric type, the default
is
single-precision floating-point, as if a
DEFSNG A-Z instruction had been given.
Table
2-5
summarizes
the
characteristics and methods of specifying numeric data
types.
2-5