That&#39;s a good insight, Brent. That placement of where is actually pretty ingenious and probably unambiguous.<br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 8, 2016 at 22:23 Brent Royal-Gordon &lt;<a href="mailto:brent@architechies.com">brent@architechies.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">&gt; This reads to me as “repeat the following block until this fails to be true”, the conditional binding in this case fails to be true if someCondition(value) isn’t true, so the loop ends. I think the key thing here is that the where clause is for the conditional binding and not the loop itself, so in this respect it behaves exactly like an if or guard statement. Meanwhile:<br>
&gt;<br>
&gt;       for eachValue in theValues where someCondition(eachValue) { … }<br>
&gt;<br>
&gt; Reads as “for everything in theValues do the following if someCondition(eachValue) is also true”, in other words this loop always tries to visit every element of the sequence (a while loop has no implicit awareness of the sequence, it’s really just an if statement that runs over and over). In this case the where clause is part of the loop itself. There may be an argument that where should be renamed on for loops to better distinguish this, but once you consider that there’s no pattern or conditional binding here I think it makes a reasonable amount of sense.<br>
<br>
The original sin here was in connecting the `where` clause to the for loop&#39;s sequence expression, rather than its pattern. If `where` were positioned right after the loop variable:<br>
<br>
        for eachValue where someCondition(eachValue) in theValues { … }<br>
<br>
It would be much clearer that `where` constrains the values seen by the loop body.<br>
<br>
I&#39;m not sure why the `where` clause was placed where it is. I suspect it has something to do with the `where` clause potentially being more complex than the sequence expression, but I was not in the room where it happened, so that&#39;s idle speculation.<br>
<br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
<br>
</blockquote></div>