Jump to content
Sign in to follow this  
Newbie2

What Does This Return Do?

Recommended Posts

Newbie2

Hello,

I'm kind of new with AutoIt.

I was wondering what this "Return" do.

Thx

For $myLoop=1 to 100
$var=1
If $var=1 Then
    MsgBox (0,"",$myLoop)
    Return
EndIf
Next

Share this post


Link to post
Share on other sites
Jos

in this case it will have the same effect as Exit.

Return is used in combination with Func...EndFunc

below a portion of the helpfile example:

msgBox(0,"Today is " & today())
Exit

Func today();Return the current date in mm/dd/yyyy form
    return (@MON & "/" & @MDAY & "/" & @YEAR)
EndFunc

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
jpm

Hello,

I'm kind of new with AutoIt.

I was wondering what this "Return" do.

Thx

For $myLoop=1 to 100
$var=1
If $var=1 Then
    MsgBox (0,"",$myLoop)
    Return
EndIf
Next
I am not sure the doc is perfect but it is better to have a look a it and you will find that the return is used inside Function (Func/EndFunc)

so your case you should get an error message because there is no function defined

Good luck in learning :whistle:

Share this post


Link to post
Share on other sites
Newbie2

So Return (out of a function) is always similar to EXIT?

Share this post


Link to post
Share on other sites
Jos

nope....

Return in the Main section is the same as Exit.

Return in a Func...EndFunc returns to the code that called it. Exit in a Func...EndFunc would stop the program.

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.