title: Convert input field string to Int in Swift
body: <p>So im very new to making APP ad Swift, im trying to do some very simple input in text fields, take the value, and use them as Int's for some calculations.</p>
  
  <p>But something is not working correct with the 'var distance' </p>
  
  <pre><code>        var handicapTal:Int
          var MagicNumber:Int
          var handicap = inputHCP.text.toInt()
          var distance = inputDistance.text.toInt()
  
          if (handicap &gt;= 0 &amp;&amp; handicap &lt;= 20)
          {
              handicapTal = 30
          }
          else if(handicap &gt; 20 &amp;&amp; handicap &lt;= 40){
              handicapTal = 10
          }
  
          MagicNumber = distance - handicapTal
  </code></pre>
  
  <p>Its the last line of code that  give an error. It says Fatal error: Cant unwrap Optional.None</p>