title: Why use static if in D?
body: <p>I have been reading about the template system in the D language and came upon a unusual construct, <code>static if</code>. </p>
  
  <p>From what I managed to grasp it is evaluated at compile time, but from what I have searched, the example shown <a href="http://en.wikipedia.org/wiki/D_programming_language">here</a> did not quite enlighten me.</p>
  
  <pre><code>template Factorial(ulong n)
  {
      static if(n &lt; 2)
          const Factorial = 1;
      else
          const Factorial = n * Factorial!(n - 1);
  }
  </code></pre>
  
  <p>What does <code>static if</code> do, and when should I use it?</p>