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

What kind of errors can b handled in QTP in real time scenario?

2 Answers   AZTEC,


Hi All, we are using QTP Automation Scripts to test SAP. I recorded QTP Automation Scripts in English-based SAP GUI. Now we have to test a French-based SAP sytem and use the same scripts. The QTP scripts are failing when executed on the French-based SAP System due to Object Recognition Issues. What can we do? Do I re-record the scripts in the French-based SAP system?

0 Answers  


How to measure transaction time through VBScript without using start and end transaction points?

0 Answers  


I open login gmail page after that QTP is not able to identify the object present in it then what u will do

3 Answers   Accenture,


Hi,will U Please Provide me details certification for QTP &QC and also please provide me the Material also. Send to mail:jjaanu2mail@gmail.com

0 Answers  


what are the different types of framesworks in QTP?what is the keyword driven framework?

2 Answers   Mindlance,


suppose i login into gmail page after that i read all the messages (say 10 messages) i have to send (SAVE) the messages in Html,notepad and i have to replay(Compose) send the messages please give me the code and give mail id so that i can clear my question

0 Answers  


What is the syntax to call one action in another?

0 Answers  


How do we do DOM programming in QTP.Could you explain with an example. If possible please provide some material or link related to DOM Programming.

0 Answers  


whai is meant by automation testing?

6 Answers  


where the object repository is located?how to choose the object repository as shared or action object repositories?

4 Answers   Datamatics,


Any one knows about descriptive programming to identify objects in a page? Kindly drop me mail prasanna.sabat@gmail.com

3 Answers  


Categories