Sign in to follow this  
Followers 0
AutoChris

Ending A Function

3 posts in this topic

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

Share this post


Link to post
Share on other sites



Just use Return instead of Exit

Share this post


Link to post
Share on other sites

Ahhhh.... I knew it was something stupid!

Thanks a lot, dmbech! :iamstupid:

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  
Followers 0