[swift-evolution] Add a while clause to for loops

Jonathan Hull jhull at gbis.com
Sat Jun 11 06:41:56 CDT 2016


The terms ‘while’ and ‘where’ are too easily confused with each other when used in the same location/context (the word shapes are almost the same).

I am not against adding this functionality, but I would recommend flipping the requirement and using the word ‘until’ instead.  I know it means adding an extra keyword, but adding ‘while’ is a recipe for error.

for x in xs until x.something {
}

I haven’t really run into the need for this yet personally (though I use for-in-where fairly often).

Thanks,
Jon


More information about the swift-evolution mailing list