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 reusable action and how the same can be implemented (process)?

2 Answers  


How QTP support all types of applications (platforms)?

0 Answers  


How to Parameterize Object repository in QTP?

6 Answers   Cognizant, IIBM,


images are dynamically changes how to compare two images with out using the bitmap

0 Answers   Hexaware,


How to Display last item of a Combobox by using QTP?

10 Answers  






Write a function which returns the addition of two numbers. give the value of the numbers outside the function.

3 Answers   SAP Labs,


What is the another extention name of library file.If that is exist than what's the differnce between them.

1 Answers   Synechron,


How can i click on any Excel sheet's "H" column with out writing coordinates Ex:Window("Book1").WinObject("Book1").Click 498,14 I dont want to give coordinates like 498,14 Can i open "H" column by writing like Ex:Window("Book1").WinObject("Book1").Click "H" or Ex:Window("Book1").WinObject("Book1").Click "H","1" or Ex:Window("Book1").WinObject("Book1").Click H,1 If i want to click on "Sheet3" of an excel sheet, Can i open like Ex:Window("Book1").WinObject("Book1").Click "Sheet3" Please help me any one

0 Answers   Livetek,


what is Smart identification

1 Answers   Wipro,


how do close the task manager through QTP?

2 Answers  


What are the different types of action?

0 Answers  


why require regression testing?

2 Answers   TCS,


Categories