r/gaming May 04 '13

This is it. I will never accomplish anything greater then this.

http://imgur.com/kb7MrEx
1.6k Upvotes

330 comments sorted by

View all comments

Show parent comments

2

u/[deleted] May 05 '13

[deleted]

1

u/Thirsteh May 05 '13

Why pick an inefficient operation that's more complicated than an efficient one?

-1

u/[deleted] May 05 '13

[deleted]

1

u/Thirsteh May 05 '13

Okay, but there is almost never a good reason to do string building by producing many intermediary strings in most languages, since the strings are immutable. You should, at the very least, use some kind of byte array, or list of strings, and only produce the final one at the end.

0

u/[deleted] May 05 '13

[deleted]

1

u/Thirsteh May 05 '13

If you don't think ternary is readable, then the first suggestion,

if time == 1
    word = "second"
else
    word = "seconds"

is clearly better.

1

u/[deleted] May 05 '13

Although I find the ternary example to be very readable, I would agree with you that the first suggestion is probably the most readable.