SHARE
TWEET

Untitled

a guest Dec 10th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. val name: String ? = null //assigned    null and it will compile    also.
  2.  
  3. fun getName(): String ? = null //returned null and it   will compile too.
  4.  
  5. /* won’t compile */
  6. val name: String ? = null
  7. val len = name.length
  8.  
  9. /* correct way */
  10. val name: String ? = null
  11. val len = name ? .length
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top