Instead of thinking that player + "," thinks of it as "," + player
So you can do something like this (psuedo-code):
onFirstName = true output = "" for each player in players: if onFirstName: onFirstName = false else: output += ", " output += player name
if your language supports it (which C ++ does):
if length of players > 0: output = players[0] for each player in players except players[0]: output += ", " + player name else: output = ""
I like the look of this last one, I have to come up with a language that really works that way.
Ponkadoodle
source share