Florian
08/31/2019, 8:30 PMwhen
without an argument is a replacement for an if-else-if
ladder. But why particularly the argument-less one? Isn't it also a replacement for if-else-if
when it has an argument?Szymon Lipiński
08/31/2019, 8:36 PMwhen
looks nicer. What's more, in the case of if (a > 0) {}
else if (b > 0) {}
else {}
it can be a little bit more difficult to pass one variable.Florian
08/31/2019, 8:40 PMMark Murphy
08/31/2019, 8:55 PMif
does not take an argument, so the comparison with the zero-argument when
is a closer matchFlorian
08/31/2019, 8:56 PM