<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">You could cast the min and max values to an Int and iterate through the Int range:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 16px; line-height: normal; font-family: Inconsolata; color: rgb(164, 176, 177);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #de5194" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> min = </span><span style="font-variant-ligatures: no-common-ligatures; color: #7f87cf" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #7f87cf" class="">UInt8</span><span style="font-variant-ligatures: no-common-ligatures" class="">.min)</span></div><div style="margin: 0px; font-size: 16px; line-height: normal; font-family: Inconsolata; color: rgb(164, 176, 177);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #de5194" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> max = </span><span style="font-variant-ligatures: no-common-ligatures; color: #7f87cf" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #7f87cf" class="">UInt8</span><span style="font-variant-ligatures: no-common-ligatures" class="">.max)</span></div></div><div style="margin: 0px; font-size: 16px; line-height: normal; font-family: Inconsolata; color: rgb(164, 176, 177);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 16px; line-height: normal; font-family: Inconsolata; color: rgb(164, 176, 177);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #de5194" class="">for</span><span style="font-variant-ligatures: no-common-ligatures" class=""> i </span><span style="font-variant-ligatures: no-common-ligatures; color: #de5194" class="">in</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #2fafa9" class="">min</span><span style="font-variant-ligatures: no-common-ligatures" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: #2fafa9" class="">max</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #2c9edb" class="">print</span><span style="font-variant-ligatures: no-common-ligatures" class="">(i)</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div></span></div><div class=""><br class=""></div><div class="">While this will work it seems like a hack to me and Milos’ solution is more elegant…</div><div class=""><br class=""></div><div class="">-Pete</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 8, 2016, at 5:50 AM, tuuranton--- via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">
  
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" class="">
  
  <div class="">
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 class=""><br class="">8. Apr 2016 11:48 by <a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>:<br class=""><br class=""><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: &quot;menlo&quot;" class="">print(UInt8.min) //0</p><p style="font-size: 11px ; line-height: normal ; font-family: &quot;menlo&quot;" class="">print(UInt8.max) //255</p><p style="font-size: 11px ; line-height: normal ; font-family: &quot;menlo&quot;" class=""><br class=""></p><p style="font-size: 11px ; line-height: normal ; font-family: &quot;menlo&quot;" class="">//Is there an easy way to loop between all values</p><p style="font-size: 11px ; line-height: normal ; font-family: &quot;menlo&quot;" class="">//between (and including both) UInt8.min and UInt8.max?</p><p style="font-size: 11px ; line-height: normal ; font-family: &quot;menlo&quot;" class=""><br class=""></p><p style="font-size: 11px ; line-height: normal ; font-family: &quot;menlo&quot;" class="">//This doesn't work.</p><p style="font-size: 11px ; line-height: normal ; font-family: &quot;menlo&quot;" class="">//Runtime crash because UInt8.max has no successor.</p><p style="font-size: 11px ; line-height: normal ; font-family: &quot;menlo&quot;" class="">for i in UInt8.min...UInt8.max {</p><p style="font-size: 11px ; line-height: normal ; font-family: &quot;menlo&quot;" class="">&nbsp; &nbsp; print(i)</p><p style="font-size: 11px ; line-height: normal ; font-family: &quot;menlo&quot;" class="">}</p><div class=""><br class=""></div></blockquote>  </div>

_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></body></html>