Re: What if Subroutine or function returns with 2 values
- From: "caglaror" <caglaror@xxxxxxxxx>
- Date: 8 May 2005 13:16:47 -0700
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.
.
- Prev by Date: Re: WMI cannot modify HKCU registry for Windows Server 2003 remotely
- Next by Date: Re: WMI cannot modify HKCU registry for Windows Server 2003 remotely
- Previous by thread: WMI cannot modify HKCU registry for Windows Server 2003 remotely
- Next by thread: Using the AutoFitColumns method for Excel SS created from ASP page
- Index(es):
Relevant Pages
|