How many ways return more then one value from function?

Answers were Sorted based on User's Feedback



How many ways return more then one value from function? ..

Answer / suresh

what is mean by that script, which statements u can write in QTP TOOL and which statements u can write in Out side QTP? write with clesr info?

Is This Answer Correct ?    4 Yes 0 No

How many ways return more then one value from function? ..

Answer / kurubaharibabu

Dear All,
I have updated all three ways the below code..



Function func1(a,b)
Dim c(3)
c(0)=a+b
c(1)=a-b
c(2)=a*b
func1=c
End Function
x=func1(2,3)
For i=0 to ubound(x)-1
msgbox x(i)
Next
'=====================================================
Function func2()
Dim c
c=array("har","babu")
func2=c
End Function
x=func2()
msgbox x(0)
msgbox x(1)
'===========================================================
Function func3()
Set dic=createobject("Scripting.Dictionary")
dic.Add "a","apple"
dic.Add"b","bal"
dic.Add"c","cat"
Set func3=dic
End Function
Set x=func3
msgbox x.Item("a")
msgbox x.Item("b")
msgbox x.Item("c")
'============================================================
Class user
Public var
Public cat
End Class
Function func4()
Set obj=new user
obj.var="hari"
obj.cat=123
Set func4=obj
End Function
Set x=func4()
msgbox x.var
msgbox x.cat
'===================================================================

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More QTP Interview Questions

In qtp, how you can exit for loop?

0 Answers  


Can you write a script for to insert array elements in an excel A to Z columns only. if the number oe elements in the array is greater than the number of columns (A to Z), come to next row and proceed furthur. eah cell should contain only one array value.

1 Answers  


Did u use check points during ur work experience ?

3 Answers   FedEx,


how to reverse a string with out using string or predefined function,ex:string is " i love india". the output should be like this "i evol aidni"

10 Answers   Aspire, MNC, Omega,


I have made the recovery scenario in script. When i am exceuting the script. it stop automatically after running recovery scenario. Please tell the resaon?

2 Answers  






How to execute a WinRunner Script in QTP?

3 Answers   IBM,


why we are using environment variables instead of global variables?

1 Answers   TCS,


Explain about reusable actions?

3 Answers   IBM,


any body can you help me what is the script to automate an comand promt

0 Answers  


Suppose U change the script whether it affect the object properties of the object in the object repository

4 Answers   IBM,


QTP is used better in which type of application Web based application or desktop application

3 Answers  


How can you write the scripts that operate on different objects depending on run-time information?

0 Answers  


Categories