Re: What if Subroutine or function returns with 2 values



Michael your answer makes me "woaha, why didnt i thought before?" i can
return values in an array, and i will make an array with result inside
the sub/function.
This point of subject is best view i think. Thanks all.
Çaglar
Michael Harris (MVP) wrote:
> > But what if there are two variables like, how can we handle the
second
> > one to the place where we call the function from?
>
>
> A function can have an array as its return value. You really have to
be
> careful with such usage. Of course, the example below is a bit
contrived
> and only illustrates the principle, not necessarily best practice or
good
> design ;-)...
>
> results = SumAndProductOf(2,3)
> msgbox results(0) & " and " & results(1)
>
> Function SumAndProductOf(x,y)
> dim z,t
> z=x+y
> t=x*y
> SumAndProductOf=array(z,t)
> End function
>
>
> --
> Michael Harris
> Microsoft MVP Scripting
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Please ask follow-up questions via the original newsgroup thread.

.



Relevant Pages

  • Re: Anyone know a lame aioe.org forger?
    ... "Michael A. Terrell" wrote: ... arrays Cherry Semiconductor or GEC/Plessey used to have back ... also claim to have an array. ...
    (sci.electronics.design)
  • Re: Use of implicit split to @_ is deprecated
    ... Michael Holzt: ... Offensichtlich verwendet split das Array ... Unverständlich ist mir hingegen, wieso zum Zwischenspeichern ... Vielleicht wird das in Perl 6 ja konsistenter gelöst sein. ...
    (de.comp.lang.perl.misc)
  • Re: Coverage Calculation Speed in VBA, VB, C# and C++
    ... know better is to declare an array that has say, 13,983,616 elements ... With Michael' s code I will add an array or vector to flag the blocks ... Modify it to check any wheel and see what you think of the speed. ...
    (rec.gambling.lottery)
  • Re: Array-Variable auf Inhalt prüfen
    ... Michael Schwimmer schrieb am 29.04.2004 ... >> undefinierte Anzahl von WErten im Array handelt. ... > End Sub ...
    (microsoft.public.de.excel)
  • Re: Recordset in Memory
    ... If you are using standard Access MDB then I know of no way to do what you have ... asked other than using an array to hold the information or using a temporary ... Michael wrote: ... and then remove it from memory when done without having to store it to ...
    (microsoft.public.access.modulesdaovba)