title: Scala pattern matching - match multiple successful cases
body: <p>I am fairly new to Scala, and would like to know if it is possible for a <code>match</code> to execute multiple matching cases at once. Without getting into too much detail, I am basically working on a function that "scores" a certain piece of text according to various traits; these traits can overlap, and multiple traits can be true for one given string.</p>
  
  <p>To illustrate what I want in code, it would look something like this:</p>
  
  <p>Say we have a String, <code>str</code>, with a value of "Hello World". I would like something along the lines of the following:</p>
  
  <pre><code>str match {
      case i if !i.isEmpty =&gt; 2
      case i if i.startsWith("world") =&gt; 5
      case i if i.contains("world") =&gt; 3
      case _ =&gt; 0
  }
  </code></pre>
  
  <p>I would like the above code to trigger <em>both</em> the first and third conditions, effectively returning both 2 and 3 (as a tuple or in any other way). </p>
  
  <p>Is this possible?</p>
  
  <p>Edit: I know this can be done with a chain of <code>if</code>'s, which is the approach I took. I'm just curious if something like the above implementation is possible.</p>