Are you expecting that this could be combined with "where" clauses?<br><br>for x in range1 where x%2==0, y in range2 where y%3==0 {}<br><br>for x in range1, y in range2 where x%2==0 && y%3==0 {}<br><br>I think it's a good idea, but the implications may be less than obvious.<br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 9, 2015 at 12:37 PM <a href="mailto:krzysztof@siejkowski.net">krzysztof@siejkowski.net</a> via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+1. Way more readable than nested loops and consistent with already existing syntax.<br>
<br>
<br>
-----Original Message-----<br>
From: Chris Eidhof via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>><br>
Reply: Chris Eidhof <<a href="mailto:chris@eidhof.nl" target="_blank">chris@eidhof.nl</a>><br>
Date: December 9, 2015 at 9:00:26 PM<br>
To: <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>><br>
Subject: [swift-evolution] Extending the for loop to have multiple clauses<br>
<br>
> I think it could be really nice to extend the for-loop so that it can have multiple clauses.<br>
> Much like in the if-let with multiple clauses, I could imagine a for-loop with multiple<br>
> clauses:<br>
><br>
> var cards: [(Suit,Rank)] = []<br>
> for x in suits, y in ranks {<br>
> cards.append((x,y))<br>
> }<br>
><br>
> This would be the same as writing:<br>
><br>
> var cards: [(Suit,Rank)] = []<br>
> for x in suits {<br>
> for y in ranks {<br>
> cards.append((x,y))}<br>
> }<br>
> }<br>
><br>
> You could also do something like:<br>
><br>
> for x in input1, y in (x..> // Do something with (x,y)<br>
> }<br>
><br>
> In fact, once we would have that, we could combine both if-let and for, and make it more<br>
> general, to end up with something like Haskell’s do-notation or C#’s LINQ. But that might<br>
> be taking it too far...<br>
><br>
> Chris<br>
> _______________________________________________<br>
> swift-evolution mailing list<br>
> <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
><br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>