Mitsubishi MELFA CR1D Instruction Manual page 197

Table of Contents

Advertisement

Def FN (Define function)
[Function]
Defines a function and gives it name.
[Format]
Def[]FN <Identification character><Name> [(<Dummy Argument> [, <Dummy Argument>]...)]
= <Function Definition Expression>
[Terminology]
<Identification character>
<Name>
<Dummy argument>
<Function Definition Expression>
[Reference Program]
1 Def FNMAve(MA,MB)=(MA+MB)/2
ues.
2 MDATA1=20
3 MDATA2=30
4 MAVE=FNMAve(MDATA1,MDATA2)
able MAVE.
5 Def FNPADD(PA,PB)=PA+PB
6 P10=FNPADD(P1,P2)
[Explanation]
(1) FN + <Name> becomes the name of the function. The function name can be up to 8 characters long.
Example) Numeric value type .... FNMMAX Identification character: M
Character string type ... FNCAME$ Identification character: C (Describe $ at the end of the name)
(2) A function defined with Def FN is called a user-defined function. A function as long as one step can be
described.
(3) Built-in functions and user-defined functions that have already been defined can be used in the function
definition expression. In this case, up to 16 levels of user-defined functions can be written.
(4) If the variables used in <Function Definition Expression> are not located in <Dummy Argument>, then
the value that the variable has at that time will be used. Also, an error will occur if during execution, the
number or argument type (numeric value or character string) of arguments differs from the number or
type declared.
(5) A user-defined function is valid only in the program where it is defined. It cannot be used by a CallP des-
ignation program.
The identification character has the following four type.
Numeric value type:M
Character string type:C
Position type:P
Joint type:J
Describe a user-selected character string. (5 is the maximum)
When a function has been called up, it is transferred to the function.
It is possible to describe all the variables, and up to 16 variables can be used.
Describe the expression for what operation to use as a function.
' Define FNMAVE to obtain the average of two numeric val-
' Substitute average value 25 of 20 and 30 in numeric vari-
' Position type addition.
Detailed explanation of command words 4-184
4MELFA-BASIC IV

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melfa cr2dMelfa cr3d

Table of Contents