title: How can I pattern match on a range in Scala?
body: <p>In Ruby I can write this:</p>
  
  <pre><code>case n
  when 0...5  then "less than five"
  when 5...10 then "less than ten"
  else "a lot"
  end
  </code></pre>
  
  <p>How do I do this in Scala?</p>
  
  <p>Edit: preferably I'd like to do it more elegantly than using <code>if</code>.</p>