Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Ending a program on error

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
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 Reply with quote

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: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group