FNx() Function - Execute User-Defined Function - BBj


For this function's original documentation, see the FNx() Function - Execute User-Defined Function.

BBj-Specific Information

Syntax

DEF FNintname%(arglist)

DEF FNobjname!(arglist)

Description

In addition to user-defined numeric and string functions, BBj also supports user-defined integer and object functions.

Parameter

Description

FNintname%

Integer function

FNobjname!

Object function

arglist

Series of simple variables separated by commas

=integer

Integer numeric expression

=expr

Any expression. This can be any number, string, or object.

Examples

Example 1

An integer function must return a numeric expression. If the numeric expression does not evaluate to an integer, !ERROR=41 is reported at runtime.

REM ' define integer function
DEF fnx%(x%)=x%

REM ' invoke integer function
LET i%=fnx%(123)

Example 2

An object function can return any expression, including any numeric, string, or object expression.

REM ' define object function
DEF fnx!(x!)=x!

REM ' invoke object function
LET x=fnx!(2*2)
LET PI=fnx!(java.lang.Math.PI)
LET x$=fnx!('GREEN')
LET i!=fnx!(new java.lang.Integer(123))

See Also

Functions - Alphabetical Listing