BlueScreen Posted March 8, 2006 Posted March 8, 2006 Hi all, Is there a possibility a function can return more than 1 value? If so, how? I have searched the HELP and couldn't find it... Thanks,
BigDod Posted March 8, 2006 Posted March 8, 2006 Hi all,Is there a possibility a function can return more than 1 value? If so, how?I have searched the HELP and couldn't find it...Thanks, Can you post an example of what you require as it is not very clear from original post. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
Moderators SmOke_N Posted March 8, 2006 Moderators Posted March 8, 2006 The only way I'm aware of being able to return more than one value, is if that value is in an array. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
BlueScreen Posted March 8, 2006 Author Posted March 8, 2006 Sure. Msgbox (0,"",x (5,4)) Func x ($y,$z) $New_y=$y*2 $New_z=$z*2 Return $New_y Return $New_z EndFunc I want it to return both $New_y and $New_z, but cannot do this: Return $New_y Return $New_z
BlueScreen Posted March 8, 2006 Author Posted March 8, 2006 The only way I'm aware of being able to return more than one value, is if that value is in an array.CODE Msgbox (0,"",x (5,4)) Func x ($y,$z) $New_y=$y*2 $New_z=$z*2 Return $New_y Return $New_z EndFunc I want it to return both $New_y and $New_z, but cannot do this: Return $New_y Return $New_z Can you apply your suggestion here?
sykes Posted March 8, 2006 Posted March 8, 2006 Msgbox (0,"",x(5,4)) Func x ($y,$z) $New_y=$y*2 $New_z=$z*2 Return $New_y & " - " & $New_z EndFunc Will that do what you want? We have enough youth. How about a fountain of SMART?
MHz Posted March 8, 2006 Posted March 8, 2006 Using an array $result = x (5, 4) For $i = 0 To UBound($result) -1 Msgbox (0,"", $result[$i]) Next Func x ($y, $z) Local $array[2], $New_y, $New_z $New_y = $y * 2 $New_z = $z * 2 $array[0] = $New_y $array[1] = $New_z Return $array EndFunc
jpm Posted March 8, 2006 Posted March 8, 2006 Hi all,Is there a possibility a function can return more than 1 value? If so, how?I have searched the HELP and couldn't find it...Thanks, By definition "Return" statement can return only one value but if you defined a parameter with the byref attribute if you change this parameter inside the function you will get the variable updated in the calling script.
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