Ropetin Again Posted August 5, 2008 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!
DaRam Posted August 5, 2008 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!
weaponx Posted August 5, 2008 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
Ropetin Again Posted August 5, 2008 Author Posted August 5, 2008 Both of you; THANK YOU THANK YOU THANK YOU!
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