[swift-evolution] repeat loop enhancement
Sean Heber
sean at fifthace.com
Wed Dec 9 15:33:56 CST 2015
> On Dec 9, 2015, at 3:21 PM, Tyler Cloutier <cloutiertyler at aol.com> wrote:
>
> Likely because
>
> for 1…5 {
>
> }
>
> is the same as
>
> for 2…6 or for 0…4
>
> which is confusing.
Those ranges are the same length and basic math would tell you that. I don’t think it’d be that big a deal. In a learning context, you wouldn’t teach it that way anyway and the students who tried it would probably end up feeling clever.
Anyway, if Swift-for is to be modified, I’d say my desire would be for the following forms:
for (range) {}
for (thing) in (range) {}
for (thing) in (range) where (stuff) {}
for (any of the above) {} else {}
Multidimensional support also seems awesome, but I could live without it. (Well okay, I could live without any of this.. but you know what I mean. :P)
l8r
Sean
More information about the swift-evolution
mailing list