Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise hash_exercises.rb: rename favorite_list to favorite_hash for clarity #97

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions ruby_basics/7_hashes/exercises/hash_exercises.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@ def create_favorite_hash(color, number)
# key of number (as a symbol) with the value of the number argument
end

def favorite_color(favorite_list)
def favorite_color(favorite_hash)
# return the value of the color key
end

def favorite_number(favorite_list)
def favorite_number(favorite_hash)
# use #fetch to return the value of the number key or 42 if the key is not found
end

def update_favorite_movie(favorite_list, movie)
def update_favorite_movie(favorite_hash, movie)
# Step 1: add/update the key of movie (as a symbol)

# Step 2: return the hash (because Step 1 returns the value of the movie key)
favorite_list
favorite_hash
end

def remove_favorite_number(favorite_list)
def remove_favorite_number(favorite_hash)
# Step 1: delete the number data

# Step 2: return the hash (because Step 1 returns the value of the number key)
favorite_list
favorite_hash
end

def favorite_categories(favorite_list)
# return the keys of favorite_list
def favorite_categories(favorite_hash)
# return the keys of favorite_hash
end

def favorite_items(favorite_list)
# return the values of favorite_list
def favorite_items(favorite_hash)
# return the values of favorite_hash
end

def merge_favorites(original_list, additional_list)
# merge the two hashes: original_list and additional_list
def merge_favorites(original_hash, additional_hash)
# merge the two hashes: original_hash and additional_hash
end