Last active
January 7, 2016 04:10
-
-
Save reergymerej/5fbf04a5ba212181c36b to your computer and use it in GitHub Desktop.
This file contains 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() { | |
while (1) { | |
var animal = catchAnAnimal(); | |
switch (animal.type) { | |
case 'meerkat': | |
Bob(animal); | |
break; | |
case 'ostrich': | |
Carol(animal); | |
break; | |
case 'snake': | |
Donald(animal); | |
break; | |
} | |
} | |
} | |
function Bob(animal) { | |
if (!animal.isTagged) { | |
addEarTag(animal); | |
} | |
if (!animal.hasHat) { | |
addHat(animal); | |
} | |
} | |
function Carol(animal) { | |
if (animal.type !== 'snake' && !animal.isTagged) { | |
addInnerEarTag(animal); | |
} | |
if (!animal.hasHat) { | |
addHat(animal); | |
} | |
} | |
function Donald(animal) { | |
if (!animal.hasLogo) { | |
sprayPaintLogo(animal); | |
} | |
Carol(animal); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment