User-Defined Procedures and Functions

Prev Next

Introduction

B4P supports standard procedures which are in fact used to defined user-specific procedures and functions. Procedures are defined as functions which do not provide a return value and must be called as a procedure. Functions are defined to always provide return values and must be called as functions where the return value must be used further. A combination of both is allowed which provides flexibility to use defined code either as a procedure or function.

Additional function names may be defined for the same user code. In this case, the local variable function name[] will be available to identify the function name used.

Inside the user-defined procedures and functions, following local variables are available, but cannot be deleted using delete() function:

Name of local variable Description
function name[] Name of called function. This is insofar useful if additional function names have been defined for the same code using define additional function() and likes.
parameter name[] Name of parameter provided. Example: hello[] is defined if one of the parameters is called hello.
parameter n[] Numbered parameter provided. If the number of parameter is not limited, then all remaining parameters are numbered, with 1 as 1st parameter.
parameter count[] Contains the number of parameters passed. This is useful if the defined function allows for flexibility regarding number of parameters passed.




Procedures and Functions Provided:


defining user procedures and user functions, user-defined function:
    define function
    define procedure
    define procedure and function

Additional function names:
    define additional function
    define additional procedure
    define additional procedure and function

Return from function calls:
    return

Check if function existing:
    function existing
    user function existing
    delete user function