<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Would this work for you?<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(200, 172, 229);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">extension</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">UInt8</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> {</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> u: </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">UInt</span><span style="font-variant-ligatures: no-common-ligatures" class=""> { </span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">UInt</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">) }</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">for</span><span style="font-variant-ligatures: no-common-ligatures" class=""> i </span><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">in</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">UInt8</span><span style="font-variant-ligatures: no-common-ligatures" class="">.min.</span><span style="font-variant-ligatures: no-common-ligatures; color: #8f793a" class="">u</span><span style="font-variant-ligatures: no-common-ligatures" class="">...</span><span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">UInt8</span><span style="font-variant-ligatures: no-common-ligatures" class="">.max.</span><span style="font-variant-ligatures: no-common-ligatures; color: #8f793a" class="">u</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(145, 84, 15);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="font-variant-ligatures: no-common-ligatures" class="">print</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(i)</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal; min-height: 15px;" class="">milos<br class=""><br class=""><font face="Source Code Pro" class=""><span style="font-variant-ligatures: no-common-ligatures; font-size: 12px;" class=""></span></font></div><div class=""><span style="font-family: -webkit-standard; font-size: medium;" class=""><br class=""></span></div><div><blockquote type="cite" class=""><div class="">On 8 Apr 2016, at 10:50, 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=""></div></body></html>