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"
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter