-
-
Save profesor79/60c86a67fb8a074a416499b0435fa689 to your computer and use it in GitHub Desktop.
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
foreach (var item in Enumerable.Range(1, 100).Select(FizzBuzz)) | |
{ | |
Console.WriteLine(item); | |
} | |
static string FizzBuzz(int number) | |
{ | |
return (number % 3, number % 5) switch | |
{ | |
(0, 0) => "FizzBuzz", | |
(0, _) => "Fizz", | |
(_, 0) => "Buzz", | |
_ => number.ToString(), | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment