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

tuuranton at tutanota.de tuuranton at tutanota.de
Fri Apr 8 04:48:07 CDT 2016


print(UInt8.min) //0

print(UInt8.max) //255




//Is there an easy way to loop between all values

//between (and including both) UInt8.min and UInt8.max?




//This doesn't work.

//Runtime crash because UInt8.max has no successor.

for i in UInt8.min...UInt8.max {

    print(i)

}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160408/1aeaca87/attachment.html>


More information about the swift-users mailing list