FUNCTION        Begin a function declaration

Top  Previous  Next

Syntax:

FUNCTION

[ func name ] [ arg1 … arg9 ]

Arguments:

[ func name ]

Variable or string specifying a previously declared function name.

 

[ arg1 … arg9 ]

Up to nine variables that are assigned when the function is called.

Options:

None

 

 

 

This script directive is used within the function declaration section of a script file to define a function named [ func name ] and enable it to be called during execution of the script file.

 

Function names may be whatever the script developer chooses to use as long as they do not conflict with script command identifiers.

 

Up to nine arguments may be passed io a function. When a function declaration is performed, variables with names matching the arguments are created. Since all variables in a FileLink script are global, function arguments should be unique from variables that may appear elsewhere in the script.

 

Consider the following example where two strings are passed as arguments to a function, assigned to variables within the function, and displayed.

 

       ;; declare our function

       BEGINFUNCTIONS

       FUNCTION MyFunction arg1 arg2

       DISPLAY arg1

       DISPLAY arg2

       RETURN

       ENDFUNCTION

       ENDFUNCTIONS

 

       ;; script execution begin here

       MyFunction "a" "b"

       STOP

 

Related Command(s): BEGINFUNCTIONS, ENDFUNCTION, ENDFUNCTIONS, RETURN