<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
I forgot to mention that I really would like to have i have type UInt8 within the loop. And since i is UInt8 it makes sense it should be able to take the values UInt8.min and UInt8.max (and all the values between).<br /><br />8. Apr 2016 11:48 by <a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>:<br /><br /><blockquote class="tutanota_quote" style="border-left: 1px solid #93A3B8; padding-left: 10px; margin-left: 5px;">
<p style="font-size: 11px ; line-height: normal ; font-family: "menlo"">print(UInt8.min) //0</p><p style="font-size: 11px ; line-height: normal ; font-family: "menlo"">print(UInt8.max) //255</p><p style="font-size: 11px ; line-height: normal ; font-family: "menlo""><br /></p><p style="font-size: 11px ; line-height: normal ; font-family: "menlo"">//Is there an easy way to loop between all values</p><p style="font-size: 11px ; line-height: normal ; font-family: "menlo"">//between (and including both) UInt8.min and UInt8.max?</p><p style="font-size: 11px ; line-height: normal ; font-family: "menlo""><br /></p><p style="font-size: 11px ; line-height: normal ; font-family: "menlo"">//This doesn't work.</p><p style="font-size: 11px ; line-height: normal ; font-family: "menlo"">//Runtime crash because UInt8.max has no successor.</p><p style="font-size: 11px ; line-height: normal ; font-family: "menlo"">for i in UInt8.min...UInt8.max {</p><p style="font-size: 11px ; line-height: normal ; font-family: "menlo""> print(i)</p><p style="font-size: 11px ; line-height: normal ; font-family: "menlo"">}</p><div><br /></div></blockquote> </body>
</html>