how can we return a value from userdefined function for eg 2
functions in func1 iam getting 2 values(a,b) and storing in
var(C). now i want to pass that var(c) to another func2 give
me the script



how can we return a value from userdefined function for eg 2 functions in func1 iam getting 2 value..

Answer / nath t

Function returns only one value. when we assign the final
value with variable that name should be the same name of
the function name.

In the given example, som is the function it returns the
sum of two values when we assign that value to variable[i.e
same as function name(example: som = c)]

if you don't assign, function doesn't return any value
(example: z = c)

Example:

Function som(a, b)
c = a + b
som = c '(instead of these two step we can write in single
step like som = a + b)
End Function

x = 10 + som(10, 20)
msgbox x

you can pass this value in any other function.

Example:
y = som(som(10, 20), x)

msgbox y

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More QTP Interview Questions

Tell me Three major differences between QTP & Winrunner?

5 Answers  


How many ways is to parameterize the value?

0 Answers  


How can I test the unix shell in QTP

2 Answers   Persistent,


We stored into the objects OR and then write the scripting

0 Answers   L&T, Wipro,


what is the difference between action and function

11 Answers   AppLabs, BirlaSoft, Infosys,






Explain how you can delete excel file in qtp?

0 Answers  


How many ways we can parameterize data in quicktest professional (qtp)?

0 Answers  


we have a link in a website or webtable How can we record link in that table or site? link is not static we don't know exact location of that link? how ? if u know pls give reply with script also?

6 Answers   Cognizant, Covansys,


What is the Diff between Image check-point and Bit map Check point?

3 Answers   Crea,


What is Test Fusion Report in QTP?

0 Answers  


What is optional step in qtp? How you can add optional step in qtp?

0 Answers  


What is the differnce between action & script

2 Answers   Lehman Brothers,


Categories