Last active
January 7, 2016 04:11
-
-
Save reergymerej/2182fbaa891682594661 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
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