Boston Python Workshop 3/Friday/Tutorial: Difference between revisions
Content added Content deleted
imported>Jesstess |
imported>Jesstess |
||
Line 515: | 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>. |
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>. |
||
=== |
====if/else==== |
||
You can use the <code>else</code> keyword to conditionally execute code when the expression for the <code>if</code> block isn't true: |
You can use the <code>else</code> keyword to conditionally execute code when the expression for the <code>if</code> block isn't true: |