switch pattern matching

PHOTO EMBED

Mon Jul 25 2022 18:03:20 GMT+0000 (Coordinated Universal Time)

Saved by @dhfinch #c# #v8

//Is it too early to learn about switch pattern matching? 
//Only available in C# v8.0 and newer (.Net Core 3.x or .Net 5.0 and newer)

    Public static double BasicOp(char op, double a, double b) => op switch
        {
            '*' => a * b,
            '+' => a + b,
            // Other ops 
            _ => 0
        };

//*Edit - fixed some syntax errors
content_copyCOPY