title: Do you prefer "if (var)" or "if (var != 0)"?
body: <p>I've been programming in C-derived languages for a couple of decades now.  Somewhere along the line, I decided that I no longer wanted to write:</p>
  
  <pre><code>if (var)    // in C
  if ($var)   # in Perl
  </code></pre>
  
  <p>when what I meant was:</p>
  
  <pre><code>if (var != 0)
  if (defined $var and $var ne '')
  </code></pre>
  
  <p>I think part of it is that I have a strongly-typed brain and in my mind, "if" requires a boolean expression.</p>
  
  <p>Or maybe it's because I use Perl so much and truth and falsehood in Perl is such a mine-field.</p>
  
  <p>Or maybe it's just because these days, I'm mainly a Java programmer.</p>
  
  <p>What are your preferences and why?</p>