[Tutor] equivalent of 'last' in perl

bob bgailer at alum.rpi.edu
Fri Oct 28 16:23:28 CEST 2005


At 09:50 PM 10/27/2005, Johan Meskens CS3 jmcs3 approximated:
>what is Python's equivalent of 'last' in perl?
>
>if flag == 1:
>         break

Yes. If flag is either 1 or 0 you may code it thus:

if flag:
       break

That's not the whole truth. Most types have a value that is seen as false 
in boolean expressions.
They includes 0 '' None False [] (,) {} 



More information about the Tutor mailing list