title: How case works in if-case
body: <p>An old C programmer could use some help with Swift.</p>
  
  <p>I don't understanding something about the if-case syntax. E.g.:</p>
  
  <pre><code>if case 20...30 = age {
     print ("in range.")
  }
  </code></pre>
  
  <p>The <code>case 20...30 = age</code> appears to be the conditional test for the <code>if</code> statement. So I was initially confused to see the assignment operator ('=') used instead of a comparison operator ('==').</p>
  
  <p>Ok, I thought to myself, that probably means the <code>case</code> statement is actually a function call that returns a boolean value. The returned value will then satisfy the comparison test in the <code>if</code> statement.</p>
  
  <p>As an experiment, I tried treating the the <code>case</code> statement like a regular conditional test and placed parentheses around it. Swift will happily accept <code>if (x == 5)</code> or <code>if (true)</code>. But <code>if (case 20...30 = age)</code> generates an error. So the <code>case</code> statement doesn't seem to behave like function.</p>
  
  <p>I'm just curious to understand what's happening here. Any insight would be greatly appreciated.</p>