forlang.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
FUNCTION (External)
                                             Up Contents Index Back
─────FUNCTION (External)────────────────────────────────────────────────────
 
     Action
 
     Identifies a program unit as a function, and supplies its name, data
     type, and optional formal parameters.
 
     Syntax
 
     [type] FUNCTION func [ [fattrs] ]
     ([ formal [ [attrs] ] ] [, formal [ [attrs] ] ] ...)
 
     Parameter          Description
 
     type               Data type of the value returned by the function.
 
                        If omitted, the applicable IMPLICIT statements
                        determine the function's type. If there are no
                        IMPLICIT statements, the function's type is
                        established by FORTRAN's default typing.
 
                        If <type> is specified, the function name cannot
                        appear in a type statement.
 
     func               The name of the function. The same name cannot
                        appear in AUTOMATIC, COMMON, DATA, EQUIVALENCE,
                        INTRINSIC, NAMELIST, or SAVE statements.
 
     [fattrs]           A list of attributes for the function, separated
                        by commas. Valid attributes are: ALIAS, C, FAR,
                        NEAR, PASCAL, VARYING.
 
     formal             A formal-argument name. If more than one is
                        specified, they must be separated by commas.
 
     [attrs]            A list of attributes for the formal argument,
                        separated by commas. Valid attributes are: FAR,
                        HUGE, NEAR, REFERENCE, VALUE.
 
     Remarks
 
     A function begins with a FUNCTION statement and ends with the
     next END statement.
 
     A function can contain any statement except a BLOCK DATA,
     FUNCTION, INTERFACE TO, PROGRAM, or SUBROUTINE statement.
 
     The length specifier for the function type may follow the
     function name.
 
     Within the calling program, <func> is global, and may not be used
     for any other variable or subprogram.
 
     FORTRAN does not support recursive function calls.
 
     Example
 
     C     GetNo is a function that reads a number from unit i
           i = 2
        10 IF (GetNo(i) .EQ. 0.0) GOTO 10
           END
     C
           FUNCTION GetNo (nounit)
           READ (nounit, '(F10.5)') r
           GetNo = r
           END
                                    -♦-