ASP Sub Procedures and Functions

by Nirmala 2009-08-11 10:54:14

Hi....
ASP Sub Procedure
Sub procedure is collection of ASP statements that performs a task and executes when it's called on event procedure. Event procedure is any clickable objects or on load event. Sub procedure does not return value but executes its content on call.
Example:
<html>
<head>
<%
sub exproc(num1,num2)
response.write(num1*num2)
end sub
%>
</head>
<body>
Result: <% call exproc(3,4) %> or Result: <% exproc 3,4 %>
</body>
</html>

ASP Function Procedure
Function procedure is a series of ASP statements enclosed by the Function and End Function statements. A Function procedure is similar to a Sub procedure, but can also return a value. A Function procedure can take arguments (constants, variables, or expressions that are passed to it by a calling procedure).
Example:
<%
Function total(price)
dim tax
tax=price*.09
total=price+tax
end Function
Response.Write("Total price is: " & total(50))
%>

Tagged in:

1066
like
1
dislike
0
mail
flag

You must LOGIN to add comments