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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Suppose I created one object as virtual object? That object is applicable to that test? Or all the tests?

764


In application which areas to be automated and what kind of situation will be take? using QTP? Plz give me the clear answer

2134


what is run action?

1644


What is the latest version of qtp?

782


what function you write to do database testing with the help of qtp?

1574


How to make qtp understand the difference amongst the same type of objects .suppose there are 5 check boxes in a page and I have to choose the 2nd one, how to do that through script?

746


i have asked earlier only one question how to test web application using QTp plz send me the answer quickly

1872


what is ODC and GDC?

7595


In the Hybrid framework, data can access the database, excel file, XML etc. Is it true?

756


What is environment variable in qtp and why to use it?

741


what frame work you are following?

1703


How can I use Call dlls in QTP ?

2025


how will you load the test cases in ddt?

1806


In a flight window we have to enter the name and meal request for every passenger.In that window if we give Total passengers=1 then the Psngr1 name field and psngr1 meal request field will reflects.if we give Total passengers=2 then Psngr1 name field and psngr1 meal request field,Psngr2 name field and psngr2 meal request field and so on. how we can handle this scenerio thru Descriptive programming?

1651


What are the different recording modes and how do they work?

819