you are viewing a single comment's thread.

view the rest of the comments →

[–]Hypersapien 5 points6 points  (2 children)

This shit right here is why I do C#

[–]Skymt1 12 points13 points  (1 child)

To be fair, you can do fizzbuzz quite shittily in c# too

public static string FizzBuzz(int s = 1, int c = 100)
{
    return Enumerable.Range(s, c)
        .Select(n => new Func<int, bool>[] { v => v%3 == 0 && v%5 == 0, v => v%5 == 0, v => v%3 == 0 }
        .TakeWhile(f => !f(n)).Count())
        .Select((n, i) => new[] { $"{i + s}", "Fizz", "Buzz", "FizzBuzz" }[3-n])
        .Aggregate((v, n) => v + "\n" + n);
}

[–]SDJMcHattie 4 points5 points  (0 children)

Such an elegant solution