Created
June 15, 2011 16:26
-
-
Save stimms/1027472 to your computer and use it in GitHub Desktop.
Linq fizzbizz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//silly | |
string result = Enumerable.Range(0, 100).Aggregate("", (current, nextValue) => | |
{ | |
if (nextValue % 3 != 0 && nextValue % 5 != 0) | |
{ | |
current += nextValue; | |
} | |
if (nextValue % 3 == 0) | |
{ | |
current += "Fizz"; | |
} | |
if (nextValue % 5 == 0) | |
{ | |
current += "Bizz"; | |
} | |
return current + "\n"; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment