3 ms·
If it's this short, the ternary operator would be the absolute best option IMHO. If any of the clauses are much longer, the first option reads a lot better if
by makeitdouble 2y ago
If it's this short, the ternary operator would be the absolute best option IMHO.
If any of the clauses are much longer, the first option reads a lot better if it can be a guard cause that returns very quick.
If neither options are short I'd argue they should be pushed away into scoped and named blocks (e.g. a function) and we're back to either a ternary operation or a guard like clause.