<p dir="ltr"><br>
var someInteger = 250<br>
if 200..&lt;299 ~= someInteger {<br>
  print(&quot;works&quot;)<br>
}</p>
<br><div class="gmail_quote"><div dir="ltr">Em sáb, 26 de mar de 2016 18:47, Maury Markowitz via swift-users &lt;<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>&gt; escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Before I stick my head into the other list, consider:<br>
<br>
   if statusCode &gt;= 200 &amp;&amp; statusCode &lt;= 299<br>
<br>
I&#39;m sure examples of something like this occur throughout your code. But the actual semantics of the test is hidden here, you&#39;re really testing if statusCode lies within a range. Swift 2.0 has a couple of options for this, but I find them all rather odd. The most recommended is:<br>
<br>
   if case 0...100 = someInteger<br>
<br>
This syntax has problems. For one thing, it&#39;s written backwards compared to most people&#39;s code...<br>
<br>
   if someinteger == 100<br>
<br>
not...<br>
<br>
   if 100 == someinteger<br>
<br>
so it just *feels* wrong. In addition, the use of &quot;case&quot; seems odd too. And finally, there&#39;s the use of the single equals sign in a test, which goes against everything we&#39;ve learned in C-like languages.<br>
<br>
So unless I&#39;m missing something, can anyone offer a reason this wouldn&#39;t work?<br>
<br>
  if someinteger in 0...100<br>
<br>
<br>
_______________________________________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br>
</blockquote></div>