Skip to content

Instantly share code, notes, and snippets.

@jboyens
Created June 21, 2010 03:53
Show Gist options
  • Save jboyens/446368 to your computer and use it in GitHub Desktop.
Save jboyens/446368 to your computer and use it in GitHub Desktop.
1 to 100 map { x =>
(x % 3, x % 5) match {
case (0, 0) => "fizzbuzz"
case (0, _) => "fizz"
case (_, 0) => "buzz"
case _ => x.toString
}
} foreach println
@mileszs
Copy link

mileszs commented Jun 24, 2010

This makes a lot more sense to me now that I've learned a bit of Erlang. I didn't get far enough into Scala to understand what the underscore was doing. Don't be surprised if my Erlang FizzBuzz looks a lot like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment