Of course that isn't very useful code. I thought it might be a useful quick test for someone learning how while loops treat different values.
On Tue, May 20, 2014 at 2:46 PM, Danny Yoo <d...@hashcollision.org> wrote: > On Tue, May 20, 2014 at 11:44 AM, C Smith <illusiontechniq...@gmail.com> > wrote: >> You can test out a condition like this in IDLE like so: >> while 6: >> print "yes its true" >> break >> >> >> while 0: >> print "yes its true" >> break >> >> >> while -1: >> print "yes its true" >> break >> >> >> emptyList = [] >> while emtpyList: >> print "yes its true" >> break >> >> This way you don't have to deal with an infinite loop. >> It will print "yes its true" once, if it IS true and then "break" will >> break you out of the loop. > > > That being said, if we're going to go through these contortions, we > might as well use "if", right? :P > > > The infinite loops in the examples above are a complete distraction > from the main point, I think. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor