[swift-evolution] Rekindling: "Extending declaration scope to condition for `repeat { } while ()"
Pavol Vaskovic
pali at pali.sk
Mon Jun 12 19:13:46 CDT 2017
On Sun, Jun 11, 2017 at 1:52 AM, Haravikk via swift-evolution <
swift-evolution at swift.org> wrote:
>
> With the ability to specify throwaway variables more easily, I'm sticking
> with my using syntax here:
>
> var theNames:[String] = []
> while let eachItem = theIterator.next() using (var theTotal = 0) where
> (theTotal < 100) {
> theNames.append(eachItem.name)
> theTotal += eachItem.value
> }
>
>
> Depending upon your preference on how to structure the using and where
> parts this is shorter and easier.
>
I think you just reinvented the C-style for loop, that was removed in
SE-0007
<https://github.com/apple/swift-evolution/blob/master/proposals/0007-remove-c-style-for-loops.md>
.
--Pavol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170613/a9ae2a62/attachment.html>
More information about the swift-evolution
mailing list