Skip to content

Instantly share code, notes, and snippets.

@amrza
Last active March 23, 2018 12:13
Show Gist options
  • Save amrza/a2c6876736beb2194225712cfba7d6b3 to your computer and use it in GitHub Desktop.
Save amrza/a2c6876736beb2194225712cfba7d6b3 to your computer and use it in GitHub Desktop.
reasonml
type schoolPerson = Teacher | Director;
let greeting = (stranger) =>
switch (stranger) {
| Teacher => "Hey professor!"
| Director => "Hello director."
};
Js.log(greeting(Teacher));
-------------------
// Generated by BUCKLESCRIPT VERSION 2.2.3, PLEASE EDIT WITH CARE
'use strict';
function greeting(stranger) {
if (stranger !== 0) {
return "Hello director.";
} else {
return "Hey professor!";
}
}
console.log("Hey professor!");
exports.greeting = greeting;
/* Not a pure module */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment