Created
March 6, 2013 10:53
-
-
Save makersacademy/5098514 to your computer and use it in GitHub Desktop.
guard clauses
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
def sell_alcohol | |
raise "call police" if client.wanted_criminal? # stops the execution | |
return if under_18? # guard clause | |
return if drunk? | |
return if broke? | |
sell_wine! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment