Format:
USR(arg)
where:
arg
is
the parameter value passed to the subroutine.
The
USR
function
is
described in more detail in Chapter
6.
USER-DEFINED FUNCTION
DEF
FN
The
DEF
function
(DEF
FN)
allows the user to define his
own
special purpose
functions and use the functions
in
his program in the same
way
that
the intrinsic
PET
BASIC functions are used.
Format:
DEF
FN
name(arg)=formula
where:
Define user function.
arg
name
formula
is
a simple floating
point
variable name one or
two
characters in length. The name can
be
longer.
but
an
alphabetic
na
me of more thao.-
five
letter_s
yields a syntax error. The
function
is
used in the program by referring to the name
FNname.
is
a simple floating
point
variable name. This
is
a
dummy
assignment
that
represents the argu-
ment value in the formula
ta
the right. A string
($)
or integer
(%)
arg
is
not allowed.
is
any
arithmetic
expression containing any
combination of numeric constants. variables.
and operators. Normally the arg appears in the
formula.
A user-defined function
is
limited
to
one SO-character line: however. a pre-
viously defined
function
can
be
used in the formula in another user-defined func-
tion.
so
user-defined functions of any desired
complexity
can
be
developed.
A user-defined
function
is
used by typing in the function name. FNname.
followed by the actual argument enclosed in parentheses.
FNname(arg) Reference user function.
Onlya
single argument can
be
passed ta a user-defined function. The func-
tion name can
be
redefined by another
DEF
FN
with
the same name in the same
program.
164