Last active
February 20, 2017 07:44
-
-
Save masaru-b-cl/23de0768d9087eb08def83e996989964 to your computer and use it in GitHub Desktop.
値の範囲で型スイッチによる分岐 in C#
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
int a = ...; | |
switch (a) | |
{ | |
case int _ when a < 10: return "low"; | |
case int _ when 90 < a: return "high"; | |
default: return "middle"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment