title: How to exit an if clause
body: <p>What sorts of methods exist for prematurely exiting an <code>if</code> clause? </p>
  
  <p>There are times when I'm writing code and want to put a <code>break</code> statement inside of an <code>if</code> clause, only to remember that those can only be used for loops.</p>
  
  <p>Lets take the following code as an example:</p>
  
  <pre><code>if some_condition:
     ...
     if condition_a:
         # do something
         # and then exit the outer if block
     ...
     if condition_b:
         # do something
         # and then exit the outer if block
     # more code here
  </code></pre>
  
  <p>I can think of one way to do this: assuming the exit cases happen within nested if statements, wrap the remaining code in a big else block. Example:</p>
  
  <pre><code>if some_condition:
     ...
     if condition_a:
         # do something
         # and then exit the outer if block
     else:
         ...
         if condition_b:
             # do something
             # and then exit the outer if block
         else:
             # more code here
  </code></pre>
  
  <p>The problem with this is that more exit locations mean more nesting/indented code.</p>
  
  <p>Alternatively, I could write my code to have the <code>if</code> clauses be as small as possible and not require any exits.</p>
  
  <p>Does anyone know of a good/better way to exit an <code>if</code> clause?</p>
  
  <p>If there are any associated else-if and else clauses, I figure that exiting would skip over them. </p>