To start with I\'ll say that I agree that goto statements are largely made irrelevant by higher level constructs in modern programming languages and shouldn\'t be used when
Sometimes I use LINQ .First()
and .Skip(1)
to handle this ... This can give a relatively clean (and very readable) solution.
Using you example,
append(array.First());
foreach(var x in array.Skip(1))
{
append(delimiter);
append (x);
}
[This assumes there is at least one element in the array, an easy test to add if that's to be avoided.]
Use F# would be another suggestion :-)