[swift-evolution] Extending the for loop to have multiple clauses

Douglas Gregor dgregor at apple.com
Wed Dec 9 15:42:06 CST 2015


> On Dec 9, 2015, at 12:00 PM, Chris Eidhof via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I think it could be really nice to extend the for-loop so that it can have multiple clauses. Much like in the if-let with multiple clauses, I could imagine a for-loop with multiple clauses:
> 
> var cards: [(Suit,Rank)] = []
> for x in suits, y in ranks {
>  cards.append((x,y))
> }


Isn’t this just

	for (x, y) in zip2(suits, ranks) {
	}

?

	- Doug



More information about the swift-evolution mailing list