Jump to content
Sign in to follow this  
igotandrew

Does return end a function?

Recommended Posts

igotandrew

Yes/no.

Func Blah(param)

If blah = blah then

return 0

else

do a bunch of stuff

endif

do more stuff

would it end at returning 0? or return 0 after "do more stuff" is executed?

Share this post


Link to post
Share on other sites
spudw2k

would it end at returning 0? or return 0 after "do more stuff" is executed?

Return stops the function and returns the value, in this case 0.

example:

msgbox(0,"Paul",_IsPaul("Paul"))
msgbox(0,"Tom",_IsPaul("Tom"))

Func _IsPaul($str)
    If $str = "Paul" Then 
        Return True
    Else
        Return False
    EndIf
EndFunc
Edited by spudw2k

Share this post


Link to post
Share on other sites
Tomb

it does in c++ so i'm sure its the same in autoit.

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  

×