The following table shows the possible forms of the function header:
Arguments Type
I Number Of I
Format of Header
No Explicit Result 1 Explicit Result
b
0 Niladac V NAME V R+NAME
1 Monadic VNAME B VRtNAME B
2 Dyadic VA NAME B VR+A NAME B
P
There must be a blank between the function name and the arguments. Also, the
same symbol cannot appear more than once in the function header; thus,
Z+FUNCTlON Z is invalid.
For user-defined functions, the order in which the arguments are entered is
important. For example, assume that Z+X DIVIDE Y represents a function in
which Z is the result of X+Y. Now if 20 DIVIDE 10 is entered, the result is 2.
However, if 10 DIVIDE 20 is entered, the result is 0.5.
3
1
1
136
Branching and Labels
Statements in a function definition are normally executed in the order indicated
by the statement numbers, and execution terminates at the end of the last state-
ment in the sequence. This normal order can be modified by branching.
Branching is specified by a right arrow (-+I followed by a label (name) that speci-
fies the statement that is to be branched to. For example, the expression
+START means branch to a statement labeled START. When assigning a label
to a statement, the label must be followed by a colon (:) and must precede the
statement. The colon separates the label from the statement:
c: a ,I
I: 9 :I ..) 'I' 14 1'
In the previous example, the label START is assigned to the second statement in
the function. In other words, START has a value of 2; however, if the function
is edited and the statement is no longer the second statement in the function,
START will automatically be given the value (or statement number) of the new
statement. (See Function Editing later in this chapter.)
137
Previous Page Next Page