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.

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