Jump to content

Return more then 1?


Recommended Posts

:D 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 by ImaNOOB
Link to comment
Share on other sites

:D 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

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
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...