since
quartileandpercentQuartileare declared as vals, you’re forced to add theelsecase which will catch erroneous input values.
That’s not all that special though. I mean you already get that with
final int quartile;
final float percentQuartile;val isn’t all that revolutionary. That’s something Java already does out of the box, with the final keyword.
I’m not a big fan of early returns in functions,
It’s a common practice though to avoid deep nesting of control statements.
Easier to read than
for(...) {
if(x != ...) {
for(...) {
if(y != ...) {
}
}
}
}Now I wonder what it would be like if we inherited guard let ___ else { return; }from Swift.
Apparently you can simulate it with
val x = blah ?: return;— — — — — — — — — — — —
when is nice though, but the primary selling point is ?. and data classes.
I kinda dread the future, though — reviewing extension methods, written by others...
I don’t see the true power of custom delegates, yet.
What was the weirdest to me as a “grumpy Java dev” is that there is no isTrue ? true : false ternary conditional operator, just if isTrue { } else { }.
