Sign in to follow this  
Followers 0
Newbie2

What Does This Return Do?

6 posts in this topic

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          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

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I GOT IT!! Thank you JdeB!

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  
Followers 0