Is it possible to return multiple values from a function..?
Then how..?
Answers were Sorted based on User's Feedback
Answer / satish j
It is possible to return multiple values from a function?
Here I am taking the return values in an array and using
them as I want
mynum1 = 0
mynum2 = 0
dim linklist(2)
imax = ubound(linklist)
Function fncl1(ByRef mynum1,mynum2, x , y)
If i= 0 Then
z = "+"
Select Case z
case "+"
mynum1 = x +y
msgbox mynum1
fncl1 = mynum1
End select
else
z = "-"
Select Case z
case "-"
mynum2 = x- y
msgbox mynum2
fncl1 = mynum2
End Select
end if
End Function
For i=0 to imax
linklist(i) = fncl1(mynum1,mynum2,5,4)
If linklist(i) = mynum2 Then
Exit for
End If
Next
msgbox linklist(0)+linklist(1)
msgbox linklist(0)&","&linklist(1)
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / rico
One way of getting mutiple values from function is by
passing values "ByRef" to the funtion and storing the
return values in the one or more arguemnts passed to the
functions.
Ex :
mysum = 0
msgbox mysum ' return 0
mysub = 0
msgbox mysub ' return 0
Function fnmul(byref mysum, mysub, x , y)
mysum = x + y
msgbox mysum 'return 9
mysub = x - y
msgbox mysub 'return 1
End Function
Call fnmul( mysum, mysub, 5, 4)
msgbox mysum 'return 9
msgbox mysub 'return 1
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / rico
If we pass the parameters by "Byval" the last two msgbox
statement will return "0"
Ex :
mysum = 0
msgbox mysum ' return 0
mysub = 0
msgbox mysub ' return 0
Function fnmul(byval mysum, mysub, x , y)
mysum = x + y
msgbox mysum 'return 9
mysub = x - y
msgbox mysub 'return 1
End Function
Call fnmul( mysum, mysub, 5, 4)
msgbox mysum 'return 0
msgbox mysub 'return 0
| Is This Answer Correct ? | 1 Yes | 3 No |
How many scripts do you write per day. What is the average number of scripts you have written in your recent project
1 Answers CenturyLink, Optum, Value Labs,
Can any body explain me how to prepare QTP frame work with an example?? alexander.gdk@gmail.com
What is the virtual object?
Print the Prime numbers in below format only up to 20(Need commas also) 1,2,3,5,7,9,11,13,17,19
What is object repository in qtp?
Can any suggest me what is exposure testing?
what is command for executing files?
Write Descriptiv prg 4 login logn....txt bx password---txt bx ok---btn
What are the advantages of parameterization ?
can u explain about QTP Frameworks? what are the framework types are available? and How to set or create frame work for a application? Explain briefly?(Also give me one example)
Difference between image checkpoint and bitmap checkpoint
Plz Explain How to access Or Store Script from VSS? Explain Real time work (qtp) where you store folders and next to how to you access that folders and how you maintain folders in VSS ? What are the Menu's in VSS? Suppose in Manual, by using Checkin Checkout u can access documents. how you access in QTp REal time?