Elektrine lite

← Feed

@Feathercrown@lemmy.world

Post #2948956

2026-05-20 19:39 UTC

One of my coworkers is fond of using ternary expressions instead of "if" blocks. Even ones without an "else". So I see things like: `condition ? someVar = "blah" : null;` or `condition ? doSomething() : null` Which should both just use "if" statements. Or my favorite: `condition ? someVar = "foo" : someVar = "bar"` which should really be `someVar = condition ? "foo" : "bar"`

Replies (1)