Skip to content

Instantly share code, notes, and snippets.

@makersacademy
Created March 6, 2013 10:53
Show Gist options
  • Save makersacademy/5098514 to your computer and use it in GitHub Desktop.
Save makersacademy/5098514 to your computer and use it in GitHub Desktop.
guard clauses
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