Guest Monkey Posted April 13, 2004 Share Posted April 13, 2004 Hello everybody... This is my first post, so be kind... Global $x x(1,2) func x ($a,$b) $c=$a+$b If $c=5 then ;c=5 Return ("1") msgbox (0,"","C=5") Else ;c<>5 Return ("0") msgbox (0,"","C<>5") EndIf EndFunc I don't really understand the 'Return' issue. Since the msgboxs are not displayed, where the script "goes" once it arrives to the Return command? Thanks for the help! Link to comment Share on other sites More sharing options...
ezzetabi Posted April 13, 2004 Share Posted April 13, 2004 Return exits the function. The program starts again from the line after where the function has been called. you can assign the func value to a variable and use it, the variable will have the return value. E.g. Global $x $h = x(1,2) If $h = 0 Then MsgBox(0,"","the function returned 0") If $h = 1 Then MsgBox(0,"","the function returned 1") func x ($a,$b) $c=$a+$b If $c=5 then ;c=5 Return ("1") msgbox (0,"","C=5") Else ;c<>5 Return ("0") msgbox (0,"","C<>5") EndIf EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted April 13, 2004 Developers Share Posted April 13, 2004 Return basically means: Stop the function here and return to where it was called from ... optionally with a return value... Global $x $rc=x(1,2) if $rc = 1 then ; c = 5 endif func x ($a,$b) $c=$a+$b If $c=5 then ;c=5 msgbox (0,"","C=5") Return (1) Else ;c<>5 msgbox (0,"","C<>5") Return (0) EndIf 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. Link to comment Share on other sites More sharing options...
Guest Monkey Posted April 13, 2004 Share Posted April 13, 2004 Thank you very very much. This was helpfull. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now