35
may be thought of as one continuous list of items, regardless of how many items
are on a line or where the lines are placed in the program.
DATA statements are non-executable and can be placed anywhere in a pro-
gram. A data statement can contain as many constants as will fit on one line
(separated by comas).
The variable type given in the READ statement must agree with the correspond-
ing constant in the DATA statement.
DATA statements may be re-read from the beginning by use of the RESTORE
statement.
No comment (with “:” or “’”) can be written after the DATA statement.
DEF FN statement
Purpose:
To define and name a function written by the user
Format:
DEF FN<name>[(<arg1>[,<arg2>]...)] = <def>
<name>, which must be a legal variable name, is the name of
the function.
<argn> is a list of variable names called parameters that will be
replaced with values calculated when the function is called. The
items in the list are separated by comas.
<def> is an expression that performs the operation of the func-
tion and is limited to one line.
Example:
DEF FNA (X, Y, Z) = SQR(X**2 + Y**2 + Z**2)
Remarks:
A user function must be defined with the DEF FN statement before it can be
called. To call a user function once it has been defined, append FN to the as-
signed name of the function and set it equal to some variable.
distance = FNA(X,5,5)
Variable names that appear in the defining expression serve only to define the
function; they do not affect program variables that have the same name.
The variables in the parameter list represent, on a one-to-one basis, the
argument variables or values that will be given in the function call.
This statement may define either numeric or string functions. If a type is speci-
fied in the function name, the value of the expression is forced to that type before
it is returned to the calling statement.
If a type is specified in the function name and the argument type does not match,
an error will occur.
DEF INT/SNG/DBL/STR Statement
Purpose:
To declare variable types as integer, single-precision,
double-precision, or string
Format:
DEF <type><letter>[-<letter>]
[<letter>[-<letter>]]...
<type> is INT, SNG, DBL, or STR
Remarks:
Any variable names beginning with the <letter(s)> listed will automatically be as-
signed to the specified variable type.
The “”, “!”, and “$” declaration characters take precedence over a DEF <type>
statement.
If no type declaration statements are encountered, BASIC assumes all variables
without declaration characters to be single-precision variables.
Commands, Statements, and Functions
Содержание C500-ASC04
Страница 1: ...C500 ASC04 ASCII Unit Operation Manual Revised February 2001 ...
Страница 5: ...iv ...
Страница 7: ...vi ...