Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Wednesday, 24 June 2015

Difference between byval and byref in vbscript

ByVal: Byval refers to the actual value of the variable.

Example:
Function fun1(Byref variable1)
variable1=variable1+1
End function

Dim x
x=3
'Pass parameter to the function byval
fun1 x

Msgbox x

Result:3

ByRef: ByRef refers to the location of where the value is stored. 

Examples: 
Function fun1(Byref variable1)
variable1=variable1+1
End function

Dim x
x=3
'Pass parameter to the function byref
fun1 x

Msgbox x

Result:4

No comments:

Post a Comment

Note: only a member of this blog may post a comment.