Created
April 23, 2014 20:52
-
-
Save bobbysmith/11231994 to your computer and use it in GitHub Desktop.
all toppings vegetarian
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
| def vegetarian? | |
| # loops through @toppings, and checks if each topping is vegetarian | |
| # if all toppings are vegetarian, return true | |
| # @toppings.each do |topping| | |
| # if topping.vegetarian != true | |
| # return false | |
| # end | |
| # end | |
| # true | |
| @toppings.all? do |topping| | |
| topping.vegetarian == true | |
| end | |
| # veg | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment