Re: Can a function return two values?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Paul Lautman (paul.lautman_at_btinternet.com)
Date: 08/12/04


Date: Thu, 12 Aug 2004 21:24:22 +0000 (UTC)

Instead of using the result of the function, simply pass the parameters by
value

Function GE()
'This is the main function
Dim a as long

call ff(a,station,offset)
GE = elevation(station, offset)

End Function

Function ff( var1, var2, var3)
'Returns station and offset to the main function

var2 = var1 +1
var3 = var1^2+1
End Function

"Anil K." <anonymous@discussions.microsoft.com> wrote in message
news:546d01c480ac$a1328770$a401280a@phx.gbl...
> Is it possible for a function to return two values to be
> used in another function?
>
> Suppose I need a function "ff" to calculate two variables
> called "station" and "offset". Is it possible to return
> both these variables to be used in another function
> called "elevation(station, offset)"?
>
> A very rough algorithm follows -
>
> End Function
>
> Function ff( var as long)
> 'Returns station and offset to the main function
>
> station = a +1
> offset = a^2+1
>
> 'How do I return both station and offset?
> ??
> End Function
>
> Function elevation (station as long, offset as long)
>
> elevation = station + offset (for simplicity)
>
> End Function
>
> THANKS IN ADVANCE.
>
>
>
>
>
>
>
>
>
>


Quantcast