[swift-users] Looping through all values between UInt8.min and UInt8.max

Erica Sadun erica at ericasadun.com
Fri Apr 8 09:45:12 CDT 2016


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



More information about the swift-users mailing list