Anonymous user
Boston Python Workshop 3/Friday/Tutorial: Difference between revisions
Boston Python Workshop 3/Friday/Tutorial (view source)
Revision as of 23:35, 11 June 2011
, 13 years ago→If/Else
imported>Jesstess |
imported>Jesstess |
||
Line 515:
In summary, things that represent emptyness or zeroness, including the boolean <code>False</code>, empty string, and 0, will evaluate to <code>False</code> in a conditional expression. Everything else, including the boolean <code>True</code>, non-empty strings, and numbers other than 0, is <code>True</code>.
===
You can use the <code>else</code> keyword to conditionally execute code when the expression for the <code>if</code> block isn't true:
|