error
Throws an IllegalStateException with the given message.
Since Kotlin
1.1Samples
import kotlin.test.*
fun main() {
//sampleStart
val name: String? = null
// val nonNullName = name ?: error("Name is missing") // will fail with IllegalStateException
//sampleEnd
}
Throws an IllegalStateException with the given message.
Since Kotlin
1.0Samples
import kotlin.test.*
fun main() {
//sampleStart
val name: String? = null
// val nonNullName = name ?: error("Name is missing") // will fail with IllegalStateException
//sampleEnd
}