Skip to content

Instantly share code, notes, and snippets.

@iwilsonq
Created March 23, 2019 21:51
Show Gist options
  • Save iwilsonq/e6191349fd29ce311f8a3683e01686e4 to your computer and use it in GitHub Desktop.
Save iwilsonq/e6191349fd29ce311f8a3683e01686e4 to your computer and use it in GitHub Desktop.
type animal =
 | Dog
 | Cat
 | Octopus;
let animalToString = animal =>
 switch(animal) {
 | Dog => "dog"
 | Cat => "cat"
 | Octopus => "octopus"
 };
let getWelcomeMessage = (name, visits, animal) => {
 "Hello " ++
 name ++
 ", you've visited this website " ++
 string_of_int(visits) ++
 " times and your favorite animal is the " ++
 animalToString(animal);
 };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment