<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="">I believe this falls under "future directions" for comparison reform.</div><div class=""><br class=""></div><div class="">Here's an example of a short term solution: <a href="https://gist.github.com/erica/77b110e17e51dbea7d6934e6582f627f" class="">https://gist.github.com/erica/77b110e17e51dbea7d6934e6582f627f</a></div><div class=""><br class=""></div><div class="">-- E, who moved this from SE to Swift Users</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On May 8, 2017, at 10:13 AM, Saagar Jha via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Well, you’re not allowed to compare optionals any more. You can try binding the value to an Int, so that it’s not an optional anymore:<div class=""><br class=""><div class=""><div class="">if let number = number {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let result = number > 0 ? 1 : 2</div><div class="">}</div><div class=""><br class=""></div><div class="">Either way, you’ll have to decide what you think should happen when number is nil.</div><div class=""><br class=""></div><div class=""><div class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Saagar Jha</div>
</div>
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 8, 2017, at 00:36, Suresh Kansujiya via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hey,<div class=""><br class=""></div><div class="">i am using ternary operator with optional variable. like below ex.</div><div class=""><br class=""></div><div class="">
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><b class="">var number:Int?<br class=""></b><b class="">let result = number > 0 ? 1 : 2 </b></blockquote><p class="gmail-p1" style="text-align:left"><b class="">here i am getting this waring : <font color="#bf9000" class="">comparison operators with optionals were removed from the Swift Standard Library. Consider refactoring the code to use the non-optional operators</font></b></p></div><div class="">Note : i must need to use ternary operator for checking.</div><div class=""><br class=""></div><div class="">Regards</div><div class="">Suresh Kansujiya</div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>