Suppose we have this code:
class QuickExample { fun function(argument: SomeOtherClass) { if (argument.mutableProperty != null ) { doSome
You could also do something like this:
class If(val any: T?, private val i: (T) -> Unit) { infix fun Else(e: () -> Unit) { if (any == null) e() else i(any) } }
You can then use it like this:
If(nullableString) { //Use string } Else { }