    return x</code></pre>

        <p>Instead, pull the line(s) out of the conditional:</p>

        <blockquote>
          <p>Good</p>
        </blockquote>

        <pre><code>if pred:            # good!
    print(&#x27;stuff&#x27;)
x += 1
return x</code></pre>


        <h3 id="while-vs-if">while vs. if</h3>


        <p>Don't use a <code>while</code> loop when you should use an <code>if</code>:</p>

        <blockquote>
          <p>Bad</p>
        </blockquote>

        <pre><code>while pred:
    x += 