2 ms·
Right, if this gets in then I officially demand that the much more innocent ternary operator and prefix/postfix increment/decrement operators get in as well.
by DrJokepu 13y ago
Right, if this gets in then I officially demand that the much more innocent ternary operator and prefix/postfix increment/decrement operators get in as well.
- LanceH 13y agoIf I had to choose, I'd pick string interpolation. i += 1 means an extra line, but that extra line is very clear. Ternary vs an if-else arguably loses on clarity except for the simplest of cases. "Today's date is #{date}. Your balance on account #{account.Number} is #{account.Balance}" "Today's date is " + date + " Your balance on account " + account.Number + " is " + account.Balance The second is a mess of +'s and "'s to me, not to mention the awkwardness of formatting spaces before and after each quote. The first, you write a sentence and plug in the variables where they belong. Not saying you're wrong, just what I would choose.