title: How to pass nullable type into function that takes a non null type?
body: <p>Is this possible if I do a null check before passing? For example:</p>
  
  <pre><code>fun main(args: Array&lt;String&gt;) {
      var num: Int? = null
      // Stuff happens that might make num not null
      ...
      if (num != null) doSomething(num)
  }
  
  fun doSomething(number: Int) {
      ...
  }
  </code></pre>
  
  <p>I don't understand why the compiler won't allow me to pass a nullable even though I check that it's not null first. Can anyone explain?</p>