by dingo_bat · 8y ago · 0 comments
Except for esoteric languages, of course. I've yet to see someone claiming some code in Malbodge is crappy and offering a refactored version. ;) Just kidding.
This is even worse in languages that have truthy values, since you don't even have the "== True" thing to help.
H = (C == 0 ? null : V == r ? (g - b) / C : V == g ? (b - r) / C + 2 : (r - b) / C + 4);Between
var v T
if (cond0) {
v = value0
} else if (cond1) {
v = value1
} else if (cond2) {
v = value2
} else {
v = default
}
and val v T = cond0 ? value0
: cond1 ? value1
: cond2 ? value2
: default
I'd much rather have the latter. var v T
switch {
case cond0:
v = value0
case cond1:
v = value1
case cond2:
v = value2
default:
v = default
}