|
Procedures or subroutines are used to perform an action. A subroutine starts with the keyword SUB then subroutine name. The code is written inside the subroutine before ending it with the keywords END SUB. Subroutines cannot return a value.
Example:
<%
SUB PrintMsg
response.write "I am in subroutine"
END SUB
response.write("Calling Subroutine <br />")
PrintMsg
%>
Passing Arguments:
<%
SUB PrintMsg (strMsg)
response.write strMsg
END SUB
response.write("Calling Subroutine <br />")
PrintMsg ("Passing argument to subroutine")
%> |