-
Notifications
You must be signed in to change notification settings - Fork 33
Branches - Linnea, Erika #24
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
base: master
Are you sure you want to change the base?
Conversation
AdagramsWhat We're Looking For
Great job! Your code for the uses_available_letters? method in particular is nice and succinct. Good job handling all the edge cases! |
letters_in_hand2 += letters_in_hand | ||
input_array.each do |char| | ||
if !letters_in_hand2.include?(char) | ||
result = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't gone over this very well but I want to name that a method can have multiple return statements in it.
This is kind of confusing because when any return statement is executed, the method immediately stops running but in a case like this, that's exactly what we want.
Because of that, we could just say return false
here rather than setting result to false and waiting to return it until later.
This is considered standard practice because it means that (1) the program can finish without doing any extra work, once it's decided it wants to return false and (2) there's no longer a need for the result variable. (Any time we can do something with less code or less variables it's usually preferable.)
highest_score[:word] = word | ||
elsif score == highest_score[:score] | ||
current_highest = highest_score[:word].length | ||
challenger = word.length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the names current_highest
and challenger
! Very short and clear for anyone to understand.
Adagrams
Congratulations! You're submitting your assignment.
Comprehension Questions
Enumerable
mixin? If so, where and why was it helpful?