do...while loops

Simon Brunning SBrunning at
Tue Feb 6 08:41:50 EST 2001

> From:	Langa Kentane [SMTP:LangaK at]
> Why is is it while 1:
Because 1 is considered a true value, so this while loop will run forever.
Or until broken, hopefully!
> would while 2:
> or 	while 3: work?
Yup - any non-zero number is considered true. They wouldn't do anything
different, though, and they just might confuse someone. (Why 2?)
Simon Brunning
TriSystems Ltd.
sbrunning at

The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.

More information about the Python-list mailing list