[swift-users] Looping through all values between UInt8.min and UInt8.max
Xiaodi Wu
xiaodi.wu at gmail.com
Fri Apr 8 12:09:08 CDT 2016
Ouch. Yes, the upper bound can't be required to have a successor.
On Fri, Apr 8, 2016 at 3:45 PM Erica Sadun <erica at ericasadun.com> wrote:
> It's a really good corner case to consider if you're thinking about
> redesigning ranges though. -- E
>
> > On Apr 8, 2016, at 8:43 AM, Nate Cook <natecook at gmail.com> wrote:
> >
> > You can stride through the maximum value of a type if you land right on
> it:
> >
> > for i in UInt8.min.stride(through: UInt8.max, by: 1) {
> > print(i)
> > }
> >
> > Nate
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160408/2632d265/attachment.html>
More information about the swift-users
mailing list