For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
Course Name Date Time Duration Type Location
An important update from QtpSudhakar. I stopped giving classroom training in MindQ Systems. I have bigger plans and I want to put an end to regular classroom training because very less people are practicing. From now onwards every session of mine is going to have explanation and practice. Everyone should practice in presence of mine and should go out of classroom with practical knowledge. So I started my own institute AnyTechLabs in Madhapur. Please reach out to +91-8328152362 for course details. Visit AnyTechLabs.com for address details.
Selenium + Cucumber 24th October 7.30 AM IST to 9.00 AM IST 45 Days WeekDay Online

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Wednesday, June 24, 2009

How to return multiple values from a function?

Usually Function procedure will return only one value. But by using arrays concept we can return multiple values from a function.
Function fnGetOddNumbersInRange(fStartRange,fEndRange)
Dim oddNumbers()
Dim cnt,iCounter
'Initiating a counter to redim the dynamic array
For iCounter=fStartRange to fEndRange
'Applying the odd number logic : num/2 <>0 then its an odd number
If iCounter mod 2<>0 Then
ReDim preserve oddNumbers(cnt)
' Storing Odd numbers in dynamic array
End If
'Assigning array to the function
End Function
'How to work with this function?
'Here Function will return array value
For i=0 to ubound(oVal)
' Displaying the values in array
msgbox oVal(i)

1 comment :

  1. How to pass arguments to the following function if we will call it in a script?

    function findflight(byval x)
    with browser(home)
    with .page(home)
    .webradiogroup(triptype).select x(0)
    .weblist(passengers).select x(1)
    .weblist(from).select x(2)
    .weblist(depmonth).select x(3)
    .weblist(depday).select x(4)
    .weblist(dest).select x(5)
    .weblist(retmonth).select x(6)
    .weblist(retday).select x(7)
    .webradiogroup(clas).select x(8)
    .weblist(pref).select x(9)
    end with
    end with

    Please help me