Is this kind of code is a good coding style in kotlin?

Viewed 50

In koltin it's common to check the input argument to avoid null value, and I often write a lot of codes like this:

fun test(text: String?) {
    text ?: return
    // do other things based of text
}

Is this a good coding style? Or there is a better one? Thanks for any comment!

0 Answers
Related