Re: Can a function return two values?
From: Paul Lautman (paul.lautman_at_btinternet.com)
Date: 08/12/04
- Next message: TommyBoy: "calling excel macro"
- Previous message: Alan Beban: "Re: Need help with writing variant back to ***"
- In reply to: Anil K.: "Can a function return two values?"
- Next in thread: Bob Phillips: "Re: Can a function return two values?"
- Messages sorted by: [ date ] [ thread ]
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.
>
>
>
>
>
>
>
>
>
>
- Next message: TommyBoy: "calling excel macro"
- Previous message: Alan Beban: "Re: Need help with writing variant back to ***"
- In reply to: Anil K.: "Can a function return two values?"
- Next in thread: Bob Phillips: "Re: Can a function return two values?"
- Messages sorted by: [ date ] [ thread ]