One Testing Center

QTP - Keyword Driven Framework. QTP Learning Book - Learn By Questions. QTP Learning Book - Made Easy - Part1. QTP Learning Book - Made Easy - Part2. QTP Quality Center - QC.

QTP - Frameworks

QTP - Frameworks. Record and Play back Framework. Action Driven Framework. Data Driven Framework. Functional Decomposition Framework. Keyword Driven Framework. Hybrid Framework. Test Driven Framework.

QTP - Automation

QTP - Basics. QTP - Intermediate. QTP - Advanced. QTP - Frameworks.

QTP - Training

Friends, Welcome to OneTestingCenter. I am HP Functional Test ExportOne. I am HP Automation Functional Test Certified Professional. I am certified for HP Functional Test 11.x. Happy to share my knowledge.

QTP - Books

QTP - Keyword Driven Framework. QTP Learning Book - Learn By Questions. QTP Learning Book - Made Easy - Part1. QTP Learning Book - Made Easy - Part2. QTP Quality Center.

Recent Post

Showing posts with label QTP - Pass ByRef and Pass ByVal. Show all posts
Showing posts with label QTP - Pass ByRef and Pass ByVal. Show all posts

QTP - Pass ByRef and Pass ByVal


' Arguments passing to functions
'  Pass ByRef
' Pass ByVal
'**********************************************************************
' Function name : Demo_PassingArgs1
' Variables: num1 , num2  --> both are declared as ByRef  (BY DEFAULT)
' Passed  arguments a,b  :  a=10, b=20
' Returning values :    a=100, b=200
' because a=num1, b=num2 ; both these values are passed as ByRef
'**********************************************************************
a=10
b=20
msgbox Demo_PassingArgs1(a,b)
msgbox a
msgbox b

Function Demo_PassingArgs1(num1,num2)
   num1=100
   num2=200
   Demo_PassingArgs1=num1+num2
End Function
'**********************************************************************
' Function name: Demo_PassingArgs2
' Variables:   num1 , num2  --> num1 and num2 are declared as ByRef 
' Passed  arguements a,b: a=10, b=20
' Returing values :  a=100, b=200
' because a=num1, b=num2 ; both these values are passed as ByRef
'*********************************************************************
a=10
b=20
msgbox Demo_PassingArgs2(a,b)
msgbox a
msgbox b

Function Demo_PassingArgs2(ByRef num1,ByRef num2)
   num1=100
   num2=200
   Demo_PassingArgs2=num1+num2
End Function
'****************************************************************************
Function name : Demo_PassingArgs3
' Variables: num1,num2;both are declared as ByVal(declared in function)
' Passed  arguements a,b      : a=10, b=20
' Returing values :   a=10, b=20
' because a=num1, b=num2 ; both these values are passed as ByVal
'*******************************************************************
a=10
b=20
msgbox Demo_PassingArgs3(a,b)
msgbox a
msgbox b

Function Demo_PassingArgs3(ByVal num1,ByVal num2)
   num1=100
   num2=200
    Demo_PassingArgs3=num1+num2
End Function
'********************************************************************
' Function name   :   Demo_PassingArgs4
' Variables :num1,num2; num1 declared as ByRef;num2 declared as ByVal
' Passed  arguements a,b  :  a=10, b=20
' Returing values :   a=100, b=20
' because a=num1 (here num1 is ByRef) , b=num2  (here num2 is ByVal)
'*********************************************************************
a=10
b=20
msgbox Demo_PassingArgs4(a,b)
msgbox a
msgbox b

Function Demo_PassingArgs4(ByRef num1,ByVal num2)
   num1=100
   num2=200
   Demo_PassingArgs4=num1+num2
End Function


GAReddy @ OneTestingCenter @ All Articles