<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I think excluding the upper bound (..<) does not address the problem correctly. The problem occurs on including the upper bound. <div class=""><br class=""></div><div class="">Consider the following simple program </div><div class=""><br class=""></div><div class=""><font face="Courier" class="">#!/usr/bin/env swift<br class=""><br class="">if let n: UInt8 = UInt8(Process.arguments[1])<br class="">{<br class=""> for i in 0...n<br class=""> {<br class=""> print (i)<br class=""> }<br class="">}</font><br class=""><br class="">this program compiles and may even pass some testing. It will run correctly for all values except 255, for which it crashes. The problem is that no one knows how many of these cases we do have in current production code and tracking these issues down may be almost impossible. </div><div class="">I would say, the take home message for know is, don’t use 0…n (i.e. include the upper bound) unless you are sure that the upper bound cannot be equal to the max value of the type. </div><div class=""><br class=""></div><div class="">I have not checked out the Swift3 branch which should fix this. Currently, with Swift2.2 I think this is a serious issue. </div><div class=""><br class=""></div><div class="">Daniel</div><div class=""><div class=""><br class=""><blockquote type="cite" class="">On 08.04.2016, at 19:47, Cody Weaver <<a href="mailto:codyleeweaver@gmail.com" class="">codyleeweaver@gmail.com</a>> wrote:<br class=""><br class="">I think an easy answer if I understand the question right is.<br class=""><br class="">let a: UInt8 = UInt8.min<br class="">let b = UInt8 = UInt8.max<br class=""><br class="">for c in a..<b {<br class=""> print(c)<br class="">}<br class=""><br class="">On Fri, Apr 8, 2016 at 10:27 AM Daniel Strobusch via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:<br class="">Hi,<br class="">just as a side note, I filed a bug on this some time ago:<br class=""><br class="">https://bugs.swift.org/browse/SR-1091<br class=""><br class="">so let’s hope, this gets fixed in Swift3. Its really annoying and dangerous because the error is not recovered at compile time.<br class=""><br class="">Daniel<br class="">_______________________________________________<br class="">swift-users mailing list<br class="">swift-users@swift.org<br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></blockquote><br class=""></div></div></body></html>