|
|
| Author |
Message |
victorf
Joined: 01 Jan 2006
Posts: 342
Location: Schenectady, New York
|
|
Posted: 31 January 2006, 1:55 AM Post subject: Ending a program on error |
|
|
Suppose I detect an error during execution that does not crash the program. Something like a bad return condition from a function. I might want to end the program at that point. I searched the docs for something like Stop or End but the best I could do is Exit. Exit can only get you out of one level of the program (i.e. Exit Sub ) but that does not terminate the program. I see ExitTask but don't get the impression that it will do what I want. If I am NOT running multiple tasks does it end the program?
Any enlightenment will be appreciated.
Vic |
|
| Back to top |
|
 |
mikep
Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX
|
|
Posted: 31 January 2006, 2:19 AM Post subject: |
|
|
There are multiple ways to end your program. For example:
1. Use ExitTask (or Exit Sub) on Main if you only have one task
2. Use SetJmp()/LongJmp() to jump to some exit routine - see http://www.zbasic.net/doc/ZBasicSysLib/ZBasicSysLib116.html
3. Use some kind of infinite loop such as: | Code: | Sub Main()
again:
goto again
End Sub |
|
|
| Back to top |
|
 |
|