How to return a value from a fn, if it has more than one value
how to return

Answers were Sorted based on User's Feedback



How to return a value from a fn, if it has more than one value how to return..

Answer / bantanahal haribabu

Dim odd()
cnt=0
Function oddnum(srange,erange)
For i=srange to erange
If i mod 2<>0 Then
ReDim preserve odd(cnt)
odd(cnt)=i
cnt =cnt+1
End If
oddnum=odd
Next
End Function
var=oddnum(1,20)
msgbox isarray(var)
For i=lbound(var) to ubound(var)
print var(i)

Next

Is This Answer Correct ?    5 Yes 1 No

How to return a value from a fn, if it has more than one value how to return..

Answer / kishan

dim arr(4) 'declare the array if necessary
function myfunction()
....
....
....
myfunction=arr 'here arr is an array

end function




Point to Remember:
1. store req values in a array and assign that array to
function name (or)
2. Concatenate all the multiple values and assign it to
function name

Is This Answer Correct ?    2 Yes 0 No

How to return a value from a fn, if it has more than one value how to return..

Answer / ram

There is only way to return more than one value that is by using call by reference. we can call function by reference passing an object.steps
1. Create class
2. Declare more than 2 elementes
3. Create object of the class
4. Call function by passing that object


please let me know if I am wrong.


Ram

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More QTP Interview Questions

what is selective recording ? and normal recording?

1 Answers   iSoft,


Analyzing the Checkpoint results ?

1 Answers   Crea,


What is the difference between action & script?

3 Answers  


hi testers,one script has three actions , at the of running three actions are running , how to set run only perticular action and what is the use of split the action? when it will be useful?

3 Answers   Syntel,


1.Qtp suppots Unix& linx or not 2why qtp suppots shell script.

0 Answers  






How Exactly we can find out the INDEX No. of any object of an application when we test that application in QTP? Explain this by giving me the example of all LINKS of G-Mail (including home page, User-account page and all possible pages you ever seen in G Mail)?????? and if your answer is that as per appearance of objects(LINKS) in application we can find out the index number in application then tell me how you find out which object(LINK) having INDEX No. 1,2,3 and so on and how you say which object(LINK) is appeared first and which is last?

4 Answers   Infosys,


Synchronization methods?

8 Answers   Ordain Solutions,


example-date format is 01-jan-09 in QTP.How to convert this format to 01-01-09?

9 Answers   Tech Mahindra,


What is the main difference between desriptive programming and generic functions

2 Answers   HCL,


What does VBS file contain..? what is VBS file.?

4 Answers  


write script for finding number of broken links in web page? kindly please answer my question.

3 Answers   Manhattan, Oracle, Virtusa,


In Descriptive programing if i use this below code will it work for login window or flight Res Window. Shud i add the properties like attached text=login and text=Agent Name in the object repository and define a new object first. Pls tell me the procedure in clear inorder to execute this script. Dialog("title:=Login").WinEdit("attached text:=Agent Name:").set"agent123" Dialog("title:=Login").WinEdit("attached text:=Password:").set"mercury" Dialog("attached text:=Login").winbutton("text:=OK").click

2 Answers  


Categories