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

write the vb script for call to new action in qtp?

0 Answers  


explain all the check point in QTP?

1 Answers   BirlaSoft,


what is error and fault in terms of software quality?

0 Answers   TCS,


QTP is not displaying in OBJECT SELECTION-CHECKPOINT PROPERTIES boxs only WINDOW AND WIN OBJECT remaining pages and links , images not displaying in web application testing. how can I get the pages and links in object selection? Please anyone tell me?

1 Answers  


Hi, When iam trying to import sheet to the QTP Global data table at the run time using the Importsheet method.It is able to import the sheet but no data is present after the import due to which the test is failing.Could anyone suggest what should be done. When I open the actual excel sheet data is present and is not corrupted.

2 Answers  






What is the difference in the global and action sheet in qtp?

0 Answers  


In Remote acess server how u run a test?

0 Answers  


what is object?

5 Answers   iFlex,


What are the types of object repository in qtp?

0 Answers  


How to retrieve alpha bate from the alphanumeric string with special character.

7 Answers   ADP, Cap Gemini,


Can I compare two DataBases using QTP ?

1 Answers  


Set DR= CreateObject("Mercury.DeviceReplay")

2 Answers  


Categories