SlimShady Posted January 28, 2005 Share Posted January 28, 2005 Tested with v3.0.103.173 I expected to see an error when I put Return outside a function. I just made a test script and I noticed it never reached my message box! See here. Return 0 MsgBox(64, "Test", "I expected to see an error or something...") Link to comment Share on other sites More sharing options...
this-is-me Posted January 28, 2005 Share Posted January 28, 2005 Isn't this acting like an Exit(0)? Who else would I be? Link to comment Share on other sites More sharing options...
Valik Posted January 28, 2005 Share Posted January 28, 2005 Isn't this acting like an Exit(0)?<{POST_SNAPBACK}>It should be, but it doesn't. It seems to exit the main loop, but doesn't actually return the value to the system. That to me is the error. Compile this or it won't work:If $CmdLine[0] > 0 Then MsgBox(4096, "", "Returning 100") Return 100 Else MsgBox(4096, "Returned", RunWait(@ScriptFullPath & " blah")) EndIfMy expectation is that the second MsgBox should say 100, but it says 0. At global scope, Return should be the same as Exit including passing the return value to the system. Link to comment Share on other sites More sharing options...
SlimShady Posted January 28, 2005 Author Share Posted January 28, 2005 Ok. I did not know that Return can be used outside a function. 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