do...while loops

Jay O'Connor joconnor at cybermesa.com
Tue Feb 6 11:15:21 EST 2001


Aahz Maruch wrote:
> 
> In article <mailman.981466899.30238.python-list at python.org>,
> Simon Brunning  <SBrunning at trisystems.co.uk> wrote:
> > From: Langa Kentane [SMTP:LangaK at discoveryhealth.co.za]
> >>
> >> Why is is it while 1:
> >> 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?)
> 
> Well, let's split the difference:
> 
> while 2.5:


Umm..then how about a counter?  Would this work?

x = 100
while x:
	print x
	x -= 1

Yeah, just tried it...it works.

Umm...anyone really like it? :)
-- 
Jay O'Connor
joconnor at cybermesa.com
http://www.cybermesa.com/~joconnor

Python Language Discussion Forum -
http://pub1.ezboard.com/fobjectorienteddevelopmentpython



More information about the Python-list mailing list