1. 10
  1.  

  2. 3

    For the C# code, I went to SO and found the top answer to the “How to do FizzBuzz” question. That’s the fairest way I know how to handle this.

    I don’t think this is fair to C#-the-language, even if it might be fair to C#-the-ecosystem.

    Here’s an implementation that more closely matches the power of the F# version, although it’s certainly less expressive. I added one last function abstraction because I wanted to separate the FizzBuzzing itself and any side effects like printing.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    		
    public static class Program
    {
    	public static bool divisibleBy(this int n, int by) => n%by == 0;
    	
    	public static string findMatch(this int n)
    	{
    		if (n.divisibleBy(3) && n.divisibleBy(5))
    			return "FizzBuzz";
    		else if (n.divisibleBy(3))
    			return "Fizz";
    		else if (n.divisibleBy(5))
    			return "Buzz";
    		else
    			return "";
    	}
    	
    	public static IEnumerable<string> fizzBuzz(int start, int end) =>
    		Enumerable.Range(start, end).Select(n => $"{n} {n.findMatch()}");
    		
    	public static void printFizzBuzz(int start, int end)
    	{
    		foreach (var x in fizzBuzz(start, end)) {
    			Console.WriteLine(x);
    		}
    	}
    	
    	public static void Main()
    	{
    		printFizzBuzz(0, 100);
    	}
    }
    
    1. 3

      I liked the article and found it valuable for clarifying some pros and cons of OO and FP that are easy to miss if you spend all your time within one or the other.

      If I was to be critical of anything, it’s that nobody really writes fizzbuzz with the goal of reuse. A more realistic example would be more convincing.