You could use
when {
myDoor.isOpen -> ...
myDoor.isClosed -> ...
myDoor.isWooden -> ...
}
Also you might be interested in this discussion about adding it
to when
. When desperately needs `it`
But I think the closest solution to your problem would be
myDoor.apply {
when{
isOpen -> ...
isClosed -> ...
isWooden -> ...
}
}