requireNotNull
Throws an IllegalArgumentException if the value is null. Otherwise returns the not null value.
@IgnorableReturnValueinline fun <T : Any> requireNotNull(value: T?): T(source)
fun greet(name: String?) { val actualName = requireNotNull(name) { "Name must not be null" } println("Hello, $actualName!") }