But if someObj is actually a `Boolean?` and you wa...
# announcements
o
But if someObj is actually a
Boolean?
and you want the function to return
someNonNullObj
if
someObj
is
true
, and
null
if it is
false
or
null
then maybe something like the following:
Copy code
fun foo(): Any? {
	return someObj?.let {
		if (it) someNonNullObj else null
	} ?: null
}