title: the filtering in Scala's for loop
body: <p>I'm a new beginner to Scala, and I'm now learning the for statements. I read this tutorial <a href="http://joelabrahamsson.com/learning-scala-part-six-if-statements-and-loops/" rel="nofollow">http://joelabrahamsson.com/learning-scala-part-six-if-statements-and-loops/</a></p>
  
  <p>And in this tutorial, there is a example,</p>
  
  <pre><code>for (person: Person &lt;- people
      if !person.female;
      name = person.name;
      if name.contains("Ewing"))
    println(name)
  </code></pre>
  
  <p>If compare this for loop to the for loop in Java, is it like</p>
  
  <pre><code>for(person: people) {
     if (!person.female) {
       String name = person.name;
       if (name.contains("Ewing"))   
         println(name)
     }
  }
  </code></pre>
  
  <p>or like this: </p>
  
  <pre><code>for(person: people) {
     String name = person.name;
     if (!person.female &amp;&amp; name.contains("Ewing")) {
       println(name)
     }
  }
  </code></pre>
  
  <p>Are the operations (in this example, name = person.name;) executed if the first filter condition "if !person.female;" is not satisfied? </p>
  
  <p>Thanks!</p>