Skip to content

Instantly share code, notes, and snippets.

@reergymerej
Last active January 7, 2016 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reergymerej/2182fbaa891682594661 to your computer and use it in GitHub Desktop.
Save reergymerej/2182fbaa891682594661 to your computer and use it in GitHub Desktop.
function Andy(animal) {
switch (animal.type) {
case 'meerkat':
Bob(animal);
break;
case 'ostrich':
Carol(animal);
break;
case 'snake':
Donald(animal);
break;
}
Elton(animal);
}
function Bob(animal) {
addEarTag(animal);
}
function Carol(animal) {
addInnerEarTag(animal);
}
function Donald(animal) {
sprayPaintLogo(animal);
}
function Elton(animal) {
addHat(animal, animal.male ? 'blue' : 'pink');
}
function Fiona() {
while (1) {
var animal = catchAnAnimal();
if (!animal.hasBeenProcessed) {
Andy(animal);
animal.hasBeenProcessed = true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment