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

What is the latest version of QTP? aster googling i found it 9.5 . but somewhere in my frnds resume i hve seen 10.0 so i am a bit confused pls let me know.

4 Answers   NCR,


What is the Dynamic Scenario in QTP? And also anybody give the example for this?

3 Answers  


Can UFT be connected to Quality Center? If ‘Yes’ brief the process or steps.

0 Answers  


Pls let me know how to find out creation time and index for the web application in descriptive programming?

2 Answers   HP,


What is the main difference between desriptive programming and generic functions

2 Answers   HCL,






How to Parameterize Object repository in QTP?

1 Answers  


how to test Web application using QTP software

4 Answers   BITS,


How to use reporter.report event in qtp ?

0 Answers  


Is it possible to test Flat file using QTP? I have two file- first file is Input file and second file is output file. Input file has Format like first 2 field is record type, next 10 field is Description. Output file also has format. I want to check this file format using QTP. Is it possible?? please reply with example.

2 Answers   Wipro,


How does QTP identify an object?

0 Answers  


When Object Repository is available what is the necessity of having Descriptive programming which needs more scripting efforts.

3 Answers  


how to test one edit box using dotnet addin for Web Applications? write script?

2 Answers   NTT Data,


Categories