[FRPythoneers] Exiting the main code block

Uche Ogbuji uche.ogbuji at fourthought.com
Fri Jun 1 13:23:03 MDT 2001

"J. Wayde Allen" wrote:
> Yesterday I was tinkering with a new program and had been thinking that
> I'd like to simply terminate the program if certain conditions occur.  I
> tried using a break statement, but that causes an error since I was
> not in a loop.  I suppose I could do something like:
>    while 1:
>       if condition == something: break
>       otherwise do stuff
> Is there a better way to cause the main program block to terminate?

If I understand what you mean,

import sys

Where status is an integer returned to the operating system (just 0 if
there's no error).

Uche Ogbuji                               Principal Consultant
uche.ogbuji at fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python

More information about the FRPythoneers mailing list