Boston Python Workshop 3/Friday/Tutorial: Difference between revisions

Content added Content deleted
imported>Jesstess
imported>Jesstess
Line 643: Line 643:
</pre>
</pre>


You don't have to have an <code>else</code> block, if you don't need it:
You don't have to have an <code>else</code> block, if you don't need it. That just means there isn't default code to execute when none of the cases match:


<pre>
<pre>
Line 654: Line 654:
print "Valentine's Day color!"
print "Valentine's Day color!"
</pre>
</pre>

If color had been "purple", that code just wouldn't have printed anything.


==Writing Functions==
==Writing Functions==