Quotes help make search much faster. Example: "Practice Makes Perfect"

Monday, December 17, 2012

LearnStreet Sample Solution to Lesson 7 Exercise 7



# This function should return the provided celebrity's favorite food. It should return:
# 1. "mexican" if the celebrity is "jennifer aniston"
# 2. "pickles" if the celebrity is "selena gomez" (read somewhere she pours pickle juice on her popcorn)
# 3. "pizza" if the celebrity is "brad pitt"
# 4. "sandwich" if the celebrity is anybody else
def favorite_food(celebrity)
#your code goes here
    if celebrity == "jennifer aniston"
        "mexican"
    elsif celebrity == "selena gomez"
        "pickles"
    elsif celebrity == "brad pitt"
        "pizza"
    else
        "sandwich"
    end
end

favorite_food("jennifer morrison")

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts