Jump to content

Ending A Function


Recommended Posts

Is it possible to end a function without ending the script?

I have a script with multiple functions. The problem I am having is that I want a particular function to end if there is an error but leave the script running so other functions can be called.

If I put "Exit" after the If statement then the whole script terminates. If I try "EndFunc" then I get an error message saying that I'm missing the "EndIf" statement. What can I do to make this possible? Here is part of my script with the Exit option...

Func Program()

$name = Inputbox("File name", "What do you want to call the file?", "")

If @error = -1 Then

  Exit

EndIf

EndFunc

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...