Branches - Linnea, Erika#24
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.
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.
Love the names current_highest and challenger! Very short and clear for anyone to understand.
Adagrams
Congratulations! You're submitting your assignment.
Comprehension Questions
Enumerablemixin? If so, where and why was it helpful?