Ropetin Again Posted August 5, 2008 Share Posted August 5, 2008 I'm sure this is REALLY obvious, but my brain is fried after staring at the screen for ~8 hour so far today. I couldn't find anything in the Help File, and my forum search didn't seem to hit anything appropriate. I have a user-defined function that processes some information passed to it. Currently it returns one value, but I would like it to return two values. Is this possible, and if so, does anyone have some basic example code? Thanks! Link to comment Share on other sites More sharing options...
DaRam Posted August 5, 2008 Share Posted August 5, 2008 Return an Array with the multiple values.I'm sure this is REALLY obvious, but my brain is fried after staring at the screen for ~8 hour so far today. I couldn't find anything in the Help File, and my forum search didn't seem to hit anything appropriate.I have a user-defined function that processes some information passed to it. Currently it returns one value, but I would like it to return two values. Is this possible, and if so, does anyone have some basic example code?Thanks! Link to comment Share on other sites More sharing options...
weaponx Posted August 5, 2008 Share Posted August 5, 2008 Either return an array or pass values by reference. $out1 = "" $out2 = "" MyFunc(4) MsgBox(0,"","$out1: " & $out1 & @CRLF & "$out2: " & $out2) Func MyFunc($in, ByRef $out1, ByRef $out2) $out1 = $in *2 $out2 = $in / 2 EndFunc $result = MyFunc(4) MsgBox(0,"","$result[0]: " & $result[0] & @CRLF & "$result[1]: " & $result[1]) Func MyFunc($in, ByRef $out1, ByRef $out2) Local $array[2] $array[0] = $in *2 $array[0] = $in / 2 Return $array EndFunc Link to comment Share on other sites More sharing options...
Ropetin Again Posted August 5, 2008 Author Share Posted August 5, 2008 Both of you; THANK YOU THANK YOU THANK YOU! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now