2 ms·
I don't think that's the way to do it in Kotlin (though I'm no expert). More idiomatic: fun myFunc(a: Int?): { if ( a == null ) { // handle t
by rattray 11y ago
I don't think that's the way to do it in Kotlin (though I'm no expert). More idiomatic:
fun myFunc(a: Int?): {
if ( a == null ) {
// handle the null case
}
// a is guaranteed non-null here
}
EDIT: And, of course, you can just use non-nullable types:
fun myFunc(a: Int) {
// a is guaranteed non-null
}