// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; public class ROP9 { public static void Test(double v) { string s = v switch { < 0.0 => "v < 0", >= 0.0 and <= 1.0 => "0 <= v <= 1", > 1.0 => "1 < v", _ => "WTF?" }; Console.WriteLine(s); } public static void Main(string[] args) { Test(0.5); } }