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

How to give Table check points?

4 Answers   ssinformatics,


write the regular expression for date format of mm/dd/yy?

10 Answers   CTS, HCL,


Pls Solve Error(SAP-CRM):- Cannot identify the specified item of the SAPNavigationBar object.Canfirm that the specified item is included in the object's item collection.

1 Answers  


How is test case write?

0 Answers  


What is the limitation to XML Checkpoints?

4 Answers   CTS,


Please have a look at this: a = Browser("Travel Boutique Online").Page("Travel Boutique Online_2").webelement("innerhtml:=2622").getroproperty("y") a=a+9 msgbox a Browser("Travel Boutique Online").Page("Travel Boutique Online_2").image("alt:=check","y:=a").click Now please let me explain. As clear from code I am trying to enter value of variable 'a' as Property y. But each time QTP AND MY SYSTEM stops responding when this line is execcuted. But When i enter some number in place of 'a' in the last line. it works fine. Please let me know what I am doing wrong at time of entering the variable in last line. Thanks a lot

3 Answers  


In qtp is it possible to check broken links of a page?

0 Answers  


How many types of recording modes in qtp?

0 Answers  


Hybrid framework supports Descriptive programming. Is it true?

0 Answers  


What is action split and the purpose of using this in qtp?

0 Answers  


During test run,How will you copy/paste from/to clipboard?

3 Answers  


how do you done Data-driven test using MS-Word Instead of DataTable

3 Answers   IBM,


Categories