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

tell me the script for envirnment value parameeter with an example. which situation envirnment valu parameter is used

2 Answers   HCL,


why use Description programming? what is advantages and disadvantage of this methods?

2 Answers  


How to change the priorities of the recovery scenario properties?

0 Answers  


QTP in mumbai

0 Answers  


in my application,validation message has in japanise language.how to validate this message is appears properly or not

0 Answers  






1)Difference Between Value & RawValue?

2 Answers   Wipro, Zensar,


how do you find the number of occurences of string QTP from the expression , " QTP+QTP=2QTP"

5 Answers   IBM,


I am a new tester that needs to create an automatic script involving security questions. On a webpage I need to select a security question(which are random) from a drop down menu, and then input the answer as the last word from the security question. I have the script set-up to automatically select the first security question from the drop down. The problem I am having is trying to insert the security answer. How do I insert the security answer based on the selection from the security question?

0 Answers  


Presently i am working on QTP 8.2 Version,i want to know features in 9.2 version, because i have not sufficient time to put the effort on the 9.2 version

0 Answers  


What is FRAME WORK? How many Frameworks can QTP supports?

4 Answers  


what the diffference between test data and test cases what is meant by object hierarchy in qtp

4 Answers   Virtusa,


how do we add a new sheet to data table in QTP?

7 Answers   TCS, Wipro,


Categories