Not saying that this is a bad proposal, but sometimes it's ok to just assign the value to a variable and use it in the
when
statement. you don't need to make everything a single expression although tend to structure my code this way myself, given Kotlin's tempting language features.