title: Safe cast vs cast to nullable
body: <p>What is the difference between</p>
  
  <pre><code>x as? String
  </code></pre>
  
  <p>and</p>
  
  <pre><code>x as String?
  </code></pre>
  
  <p>They both seem to produce a <code>String?</code> type. The <a href="https://kotlinlang.org/docs/reference/typecasts.html" rel="noreferrer">Kotlin page</a> doesn't answer it for me.</p>
  
  <p>UPDATE:</p>
  
  <p>To clarify, my question is:</p>
  
  <p>What is the purpose of having an <code>as?</code> operator at all, since for any object <code>x</code> and for any type <code>T</code>, the expression <code>x as? T</code> can be (I think) rephrased as <code>x as T?</code> ?</p>