title: How to assign a null value to a function type variable in Kotlin?
body: <p>I have a variable that holds a callback, and by default it's value should be null. But this syntax doesn't seem to work.</p>
  
  <pre><code>var callback1 : () -&gt; Unit = null
  var callback2 : ((a) -&gt; c, b) -&gt; Unit = null
  </code></pre>
  
  <p>My current solution is to make sure that callbacks have default implementations.</p>
  
  <pre><code>var callback1 : () -&gt; Unit = { }
  var callback2 : ((a) -&gt; c, b) -&gt; Unit = { a, b -&gt; }
  </code></pre>
  
  <p>This, however, makes it hard to check whether or not the callback was set, and possibly default implementation comes at some cost (is that so?). How to assign a null value to a function type variable in Kotlin?</p>