FUNCTION Begin a function declaration |
Top Previous Next |
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 to a function. When a function declaration is performed, variables with names matching the arguments are created. Since all variables in a Robo-FTP 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
|