Kotlin when else do nothing
Kotlin has two existing possibilities to express a "do nothing" construct
in when statements. Either Unit or an empty pair of braces. An empty block
will just execute nothing. There's nothing else planned in that regard
To answer your question regarding "also, what is this actually doing?"
for the empty block, looking at the bytecode and translating it into
Java helps:
val x = 33
when(x)
{
1 -> {}
2 -> Int
3 -> Unit
else -> Double
}
Translates to
int x = 33;
switch(x) {
case 1:
case 3:
break;
case 2:
IntCompanionObject var10000 = IntCompanionObject.INSTANCE;
break;
default:
DoubleCompanionObject var1 = DoubleCompanionObject.INSTANCE;
}