Last active
July 1, 2019 09:17
-
-
Save Temidtech/3e2b186d0110f3d1990ef169c813d922 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>) { | |
val location: Any = "Code must compile!" | |
val safeString: String? = location as? String | |
val safeFloat: Float? = location as? Float | |
println(safeString) | |
println(safeFloat) | |
} | |
//Compiler returns this output: | |
Code must compile! | |
null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment