Jump to content
Sign in to follow this  
Newbie2

What Does This Return Do?

Recommended Posts

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

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...