STATEMENT:  FUNCTION

FUNCTION . . . END FUNCTION

The FUNCTION statement creates a function, assigns a name, and allows you to list the arguments which are to be passed into the function.

Note the major difference between a function and a subroutine, is that a function can return a value back to where it was called from.

As an option, functions can be declared PRIVATE or PUBLIC. 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.

Code:
<% FUNCTION aardvark %>
   <% REM you can place all of the code you desire inside a function %>
<% END FUNCTION %>

Code:
<% PRIVATE FUNCTION aardvark %>
   <% REM you can place all of the code you desire inside a function %>
<% END FUNCTION %>

You can list more than one argument in the function.

Code:
<%
FUNCTION aardvark(myvar1, myvar2, mynumber, myarray)
   REM you can place all of the code you desire inside a function
END FUNCTION
%>

Copyright 1999 by Infinite Software Solutions, Inc.
Trademark Information