RosettaCodeData/Task/Null-object/Kotlin/null-object.kotlin

10 lines
311 B
Text
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
// version 1.1.0
fun main(args: Array<String>) {
val i: Int = 3 // non-nullable Int type - can't be assigned null
println(i)
val j: Int? = null // nullable Int type - can be assigned null
println(j)
println(null is Nothing?) // test that null is indeed of type Nothing?
}