is there a way to refer to `when` condition withou...
# announcements
k
is there a way to refer to
when
condition without binding it to a name? some sort of default provided name? For example in the code below, is it possible to write it without the
temp
variable?:
Copy code
val temp = foo.bar.getBaz()
when (temp) {
is A -> print(temp)
is B -> ...
}
s
Copy code
when (val temp = foo.bar.getBaz()) {
  is A -> print(temp)
  is B -> ...
}
I’m pretty sure the IDE will suggest this in most simple situations
k
thanks! just found it in the docs.. must have missed it on a first read