title: How to check if a "lateinit" variable has been initialized?
body: <p>I wonder if there is a way to check if a <code>lateinit</code> variable has been initialized. For example:</p>
  
  <pre><code>class Foo() {
  
      private lateinit var myFile: File
  
      fun bar(path: String?) {
          path?.let { myFile = File(it) }
      }
  
      fun bar2() {
          myFile.whateverMethod()
          // May crash since I don't know whether myFile has been initialized
      }
  }
  </code></pre>