Created
February 12, 2022 19:03
-
-
Save arthurgubaidullin/719a47523681618169ebc5f4399029a0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
type person = Streamer(string) | Mr(string) | |
let kirJs = Streamer("KirJS") | |
let mrLapteuh = Mr("Lapteuh") | |
let say = person => | |
switch person { | |
| Streamer(name) => name ++ ": " ++ "Yes, mr. Lapteuh." ++ "\n" | |
| Mr(name) => "Mr. " ++ name ++ ": " ++ "Say my name!" ++ "\n" | |
} | |
let persons = [mrLapteuh, kirJs] | |
Js.Array.forEach(p => Js.Console.log(say(p)), persons) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment