Version: 1.0
The Function statement creates a function, assigns a name, and allows you to list the arguments (if any) which are to be passed into the function.
The major difference between a function and a subroutine, is that a function can return a value back to where it was called from. The returned value must be assigned to the function name (or Set if it is an object) somewhere inside the function. However, you do not not have to assign or Set a return value.
<%
Function aardvark
Rem you can place all of the code you desire inside a function
End Function
%>
<% Private Function aardvark
Rem you can place all of the code you desire inside a function
End Function
%>
As an option, functions can be declared Private or Public (the default). One option for leaving a Function is to use Exit statements. You can call other functions or subroutines from within a function (nesting). You must end every function with End Function or you will get an error message.
<%
Function aardvark(myvar1, myvar2, mynumber, myarray)
Rem you can place all of the code you desire inside a function
End Function
%>
You can list mroe than one argument in the function.
<%
returnval = aardvark(myvar1, myvar2, mynumber, myarray)
%>
When you call a function that is assigned to a variable and it has one or more arguments, you must enclose the arguments inside parentheses, otherwise yo will get an error.