Cannot match values of type
<p>I'm just starting out with Swift 3 and I'm converting a Rails project to swift (side project while I learn)</p>
<p>Fairly simple, I have a Rails statement Im converting and Im getting many red errors in Xcode:</p>
<pre><code>let startingPoint: Int = 1
let firstRange: ClosedRange = (2...10)
let secondRange: ClosedRange = (11...20)

func calc(range: Float) -&gt; Float {
  switch range {
    case startingPoint:
     return (range - startingPoint) * 1 // or 0.2
    case firstRange:
     return // code
    default:
     return //code
  }
}
</code></pre>
<p><code>calc</code> will either have an <code>Int</code> or <code>Float</code> value: <code>10</code> or <code>10.50</code></p>
<p>Errors are:</p>
<blockquote>
<p>Expression pattern of type ClosedRange cannot match values of type Float</p>
<p>Binary operator - cannot be applied to operands of type Float and Int</p>
</blockquote>
<p>I understand the errors but I dont know what to search for to correct it. Could you point me in the right direction, please?</p>