can a Function return more than one value..??? if so please
give me the code for that.

Answers were Sorted based on User's Feedback



can a Function return more than one value..??? if so please give me the code for that...

Answer / bantanahal haribabu

function exmp(a,b)
dim myarray(2)
myarray(0)=a+b
myarray(1)=a*b
exmp=myarray
end function
val=exmp(2,3)
msgbox isarray(val)
for i=o to ubound(val)
msgbox val(i)
next

Is This Answer Correct ?    4 Yes 0 No

can a Function return more than one value..??? if so please give me the code for that...

Answer / prasad

Function alway returns one value. only action in QTP
returns more than one values.

Is This Answer Correct ?    3 Yes 0 No

can a Function return more than one value..??? if so please give me the code for that...

Answer / siqtp

Logically Function can return pnly one value.But we can
achieve rturning multiple values using any of the following

1)Concatenate all the values to be returned to a string and
retuen it
2)Use arrays
3)Use dictionay object
4)use ByRef

Is This Answer Correct ?    2 Yes 0 No

can a Function return more than one value..??? if so please give me the code for that...

Answer / uday kumar _ anem

Another way to handle more than one return value is using
arrays and also use global variables.

Is This Answer Correct ?    2 Yes 1 No

can a Function return more than one value..??? if so please give me the code for that...

Answer / nath t

Function doesn't return more than one value.

if you want to get more than one result, we can write
function for that. After u will get the value u have to
split the value.

Example:

Function AddSub(a, b)
som = a + b
subt = a - b
AddSub = som&"/"&subt
End Function

this function returns only one value. But it's having two
results(i.e Addition and subtraction of two no.s).

After u will get this value. u have to split that one for
two results by using split function here delimeter is "/".

like this we can add more than one result to the return
variable(in this example AddSub is the return variable).

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More QTP Interview Questions

In VSS, HoW the documents send to local folder? copy paste or any other? plz explain about VSS TOOL kit?

2 Answers   Oracle,


Hi, how can we check or avoid the memory leakage in QTP9.2?

0 Answers   Arctern,


how to create the varibles and how these are connect to qtp? plz tell me

3 Answers  


What is the use of "Registeruserfunc" when should we use it? Note:Please do not copy paste the date from QTP help. I tryed it.But I don't Understand where should we use exactly.

5 Answers   Livetek,


hi guys, could you please prepare script for given format ? 1,1,2,3,5,8,13,21,...etc use vbscript for this...?

2 Answers   Value Labs,


Hi, Any one have the crack for QTP 10.0,if so could you please send it to phanijuly10@gmail.com

2 Answers  


What is the best institute in Ameerpet? If people think Ameerpet is the pride of hyd they need to go to Delhi/Gurgaon/noida you can find the difference.

3 Answers  


Can we record using all the modes in a single script? Explanation with example is appreciated

0 Answers  


Explain roles and responsibilites of 2yrs Automation qtp engineer.

3 Answers   Oracle,


I want to open a Notepad window without recording a test and I do not want to use SystemUtil.Run command as well How do I do this?

12 Answers  


In smart identification, explain about 1. Base filter properties 2. optional filter properties with examples?

2 Answers   TCS,


Hi, I want to write the script for a webpage. But i didn't added the properties of the objects to the object repository. Without adding the object properties to the object repository, how to write the script. When i am writing the script, Let us say i typed as Browser (""). after selecting ".", if the object is added to the object repository it will display atomatically. But in my case it is not as i didn't added the object properties. How to proceed further in the above mentioned case to write the script manually. Pls let me know if you didn't understand the question.

3 Answers  


Categories