|
|
|
|
|
by LanceH
4434 days ago
|
|
If 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. |
|