ImaNOOB Posted June 5, 2006 Share Posted June 5, 2006 (edited) Is it possible to return more then 1 variable in a function? For example func pie($a, $b) $a = $a * 2 $b = $b * 2 return $a return $b endfunc Edited June 5, 2006 by ImaNOOB Link to comment Share on other sites More sharing options...
Simucal Posted June 5, 2006 Share Posted June 5, 2006 Is it possible to return more then 1 variable in a function? For example func pie($a, $b) $a = $a * 2 $b = $b * 2 return $a return $b endfunc I dont believe so. Return an array: global $x[3] func pie($a, $b) $x[1] = $a * 2 $x[2] = $b * 2 return $x endfunc AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
Uten Posted June 5, 2006 Share Posted June 5, 2006 Or use ByRef (althought that will modify your variables in the callers context) func pie(ByRef $a, ByRef $B) $a = $a * 2 $b = $b * 2 endfunc Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Valuater Posted June 5, 2006 Share Posted June 5, 2006 i use dim quite often... then i can make the value anything i want thoughout the entire script including any function Dim $a, $b and thats it 8) Link to comment Share on other sites More sharing options...
MHz Posted June 5, 2006 Share Posted June 5, 2006 Valuater, members have been burned to the stake for using Call() when not needed with misuse. Same can be said with using Dim. Using Dim outside a function is as useless as using Local outside a function as well. The only thing of using these 2 declarators outside functions is the chance of confusion. Here is a hopefully easy and good example of how declarators scopes are used/misused. ; Seen everywhere Global $variable ; Why not be crystal clear and use Global Dim $somevariable ; Why not be crystal clear and use Global Local $redherring Func _function() ; Seen only to this function Local $variable ; Seen everywhere as already Global Dim $variable ; Seen only to this function as not already Global Dim $anothervariable EndFunc @ImaNOOB Also have a look at SetExtended() for returning an integer 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