ASP parameters in the function call on the impact of
In the ASP programming, often need to prepare their own function (or process) to achieve certain specific functions, then often need to function (or process) in the corresponding parameters transfer function (or process) for data processing, that is, there may be a need to retain or change the value of parameters, the following are examples of related with the following function (TestAddress) can be a function of the number of possible return value (a function return value, a number of parameters to change the value)
Example:
<% @ LANGUAGE = "VBSCRIPT"%>
<%
Option Explicit
'================================================= ==================
'Parameter Passing
'1. Value transfer parameters (Call By Value)
'Function TestValue (ByVal A, ByVal B)
'Function within the parameters A, B changes do not affect the function of the external variables
'
'2. Pointer parameters (Call By Address)
'Function TestAddress (ByRef A, Byref B)
'Function within the parameters A, B changes affect the function of the external variables
'
'Note:
'1. Parameters can be figures, characters, arrays, objects VBSCRIPT language supported by most types
'2. Function return value type may also be the number of characters in an array, the object VBSCRIPT language supported by most types
'3. Procedure Call function similar methods and parameters
'================================================= ==================
Dim A1, B1
Dim A2, B2
Function TestValue (ByVal A, ByVal B)
A = A + 1
B + B = 1
TestValue = A + B
End Function
Function TestAddress (ByRef A, Byref B)
A = A + 1
B + B = 1
TestAddress = A + B
End Function
A1 = 11
B1 = 33
A2 = 11
B2 = 33
Response.Write "initial:" & ""
Response.Write "A1 =" & A1 & ""
Response.Write "B1 =" & B1 & "<BR>"
Response.Write "function (TestValue) values:" & TestValue (A1, B1) & "<BR>"
Response.Write "terminal value:" & ""
Response.Write "A1 =" & A1 & ""
Response.Write "B1 =" & B1 & "<BR> <BR> <BR>"
Response.Write "initial:" & ""
Response.Write "A2 =" & A2 & ""
Response.Write "B2 =" & B2 & "<BR>"
Response.Write "function (TestAddress) values:" & TestAddress (A2 and B2) & "<BR>"
Response.Write "terminal value:" & ""
Response.Write "A2 =" & A2 & ""
Response.Write "B2 =" & B2
'======================
'Similar process
'======================
Sub Test_Value (ByVal A, ByVal B)
A = A + 1
B + B = 1
End Sub
Sub Test_Address (ByRef A, Byref B)
A = A + 1
B + B = 1
End Sub
'Similarly, an array of transmission, object (or change its function in the value of property)
'Directly to the target object as a parameter
'Array, the array as a parameter name
Redim aryTest (2,2)
Dim intNum
Function Ary_Test (ByRef A)
Ary_Test = Ubound (Ary_Test, 2)
End function
'Call
IntNum = Ary_Test (intNum) 'value is 3
%>








0 Comments to “ASP parameters in the function call on the impact of”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.