Greet
Sat Oct 16 2021 16:14:10 GMT+0000 (Coordinated Universal Time)
Saved by
@funcProgramming
Option<string> _ = None;
Option<string> john = Some("John");
string greet(Option<string> greetee)
=> greetee.Match(
None: () => "Sorry, who?",
Some: (name) => $"Hello, {name}"
);
greet(None) // => "Sorry, who?"
greet(Some("John")) // => "Hello, John"
content_copyCOPY
Comments