nawar
06/19/2017, 1:56 PMif let person = item as? Person, /* where */ person.name == "Mike" {
// do something here with Mike
}
be written better than this one in Kotlin
val person = item as? Person
if (person != null && person.name == "Mike") {
// do something with Mike
}
What I’m looking for is a way to consolidate the initialization in the if condition. Something even PHP has as well. like
if ($person = item ) { ... }