Reading the coding horror, I just came across the FizzBuzz another time.
The original post is here: Coding Horror: Why Can\'t Programmers.. Program?
For thos
The null-coalescing operator is really useful:
string output = null; for (int i = 1; i <= 100; i++) { if (i % 3 == 0) output += "fizz"; if (i % 5 == 0) output += "buzz"; Console.WriteLine(output ?? i.ToString()); output = null; } Console.ReadKey();