-
Notifications
You must be signed in to change notification settings - Fork 50
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
Sockets - Sarah #43
base: master
Are you sure you want to change the base?
Sockets - Sarah #43
Conversation
Portmanteau GeneratorWhat We're Looking For
|
|
||
|
||
def get_word_from_user(word) | ||
puts "What is the #{word} to combine?" |
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.
word
as a variable on its own is weird here. My own (admittedly fiddly) opinion is that it's not descriptive enough. Maybe word_num
, or cardinal
?
|
||
def get_word_from_user(word) | ||
puts "What is the #{word} to combine?" | ||
word = gets.chomp.to_s |
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.
I would also advise against reusing this variable again for a different purpose! Part of your job is to convey the semantic meaning of your code with variable names, so using word
to mean both the cardinality of the word (first second etc.) and the word that we fetch from the user is confusing!
end | ||
|
||
|
||
def chop_second_word(second_word) |
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.
I bet you could find a clever way to combine chop_first_word
and chop_second_word
second_word = get_word_from_user("second word") | ||
|
||
first_half = chop_first_word(first_word) | ||
second_half = chop_second_word(second_word) |
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.
This this beautiful! Great use of methods!
Portmanteau Generator
Congratulations! You're submitting your assignment.
Comprehension Questions
is_vowel?
method affect your project?