Open coolaj86 opened 2 years ago
This rule comes from pretty much all decent languages (Go, Zig, Python).
let a = b ? c : d ? : e;
// assign the fallback value let a = e; if (b) { if (c) { // update if the right conditions are met a = d; } }
Ternaries are the devil's playground.
Readability counts.
This rule comes from pretty much all decent languages (Go, Zig, Python).
❌ Bad
✅ Good
Rationalé
Ternaries are the devil's playground.