Skip to content

Instantly share code, notes, and snippets.

@vai
Created January 27, 2013 10:33
Show Gist options
  • Select an option

  • Save vai/4647768 to your computer and use it in GitHub Desktop.

Select an option

Save vai/4647768 to your computer and use it in GitHub Desktop.
#pragma indent
using System.Linq
using System.Console
module Program
Main() : void
// Specify our pairs of ([divisors], text) to override
def pairs = [([3,5], "FizzBuzz"), ([3], "Fizz"), ([5], "Buzz")]
// Allow retrieval of the appropriate word
def wordFor (x)
pairs.FirstOrDefault( y => y[0].All( i => x % i == 0) )[1] ?? $"$x"
// Output our results for the set range
foreach ( i in [1..100] ) WriteLine( wordFor(i) )
_ = ReadLine()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment