Ellen Spertus
05/29/2022, 3:54 PMfun myfun: Boolean {
return foo?.stringProperty.isNullOrEmpty()
}
It seems to me that this would return null , which is not Boolean when foo is null. Why is the above code legal?Sam
05/29/2022, 4:00 PM? before the final function call. isNullOrEmpty is an extension on a nullable type, so it can be called with a null receiver and will still return a non-null value.Francesc
05/29/2022, 4:01 PMFrancesc
05/29/2022, 4:02 PM