Idiomatic if with kotlin

Here is a safe and idiomatic way to the null safe Kotlin operator to check against a value and execute some code.

someObject?.takeIf{ it.status }?.apply{ doThis() }

And here is a real word example:

 item?.takeIf { it.itemId == android.R.id.home }?.run {
            onBackPressed()
        }