Advertisement
Guest User

Untitled

a guest
Jul 12th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. fun main(args: Array<String>) {
  2.  val location: Any = "Code must compile!"
  3.  val safeString: String? = location as? String
  4.  val safeFloat: Float? = location as? Float
  5.  println(safeString)
  6.  println(safeFloat)
  7.  }
  8.  
  9. //Compiler returns this output:
  10.  
  11.   Code must compile!
  12.   null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement