Jump to content
Sign in to follow this  
SlimShady

Return - Expected error

Recommended Posts

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...")

Share this post


Link to post
Share on other sites

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"))
EndIf

My 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.

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...