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 |
what is meant by automation tool?
How Does Run time data (Parameterization) is handled in QTP?
What is Automation frame work.How we will prepare in real time.
write a qtp script to enter user name & password for flight reservation login page from excel sheet
I want to know can we integrate visual source safe tool with QTP and QC for our version controlling process? WE know QTP and QC 10.0 version is having the version control inbuilt in it but I want to know the merits and demerits of the inbuilt version control tool and the visual source safe tool using QTP and QC.
Hi all , I have installed the QTP 11.0 Whenever I am opening QTP that time if any open Internet Explorer I was getting message (Internet Explorer has encountered a problem and needs to close. we are sorry for inconvenience caused) and same way new browser also not opening. If you have any idea please let me know.
What is the Difference Between Quick Test Pro and Quick test professional?
How to apporach while starting the automation testing?
What is VSS? Is it used in Automation(QTP) Or Manual? what is menus in VSS?
Does UNIX support QTP? If not what is the other tool used for Unix environment?
Among the 4 capture levels, Complete, Partial, Minimal, None. which one is mostly used?
If some requirements r changed during the testing process ,then how can u handle this in frame work?