-
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 - Riyo #38
base: master
Are you sure you want to change the base?
Sockets - Riyo #38
Conversation
Portmanteau GeneratorWhat We're Looking For
|
def run_generator | ||
# Gets input from user for first word, will not accept fewer than two letters | ||
puts "What's the first word you would like to combine?: " | ||
word_a = gets.chomp.downcase |
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.
good work making this work with lowercase!
puts "Please try again and enter your second word: " | ||
word_b = gets.chomp.downcase | ||
end | ||
puts "The first word is #{word_a}" |
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.
One general changed I'd look for in your code is more whitespace! It's good to group code by adding blank lines so that we can tell what sections represent a "single thought". Convention in most workspaces is to have whitespace before and/or after loops and method declarations.
word1_vowels = [] | ||
word_a.each_char do |letter| | ||
word1 << is_vowel?(letter) | ||
end |
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 talked about this a little in class, but this solution while effective, isn't efficient. It might be better to discover the index by counting backwards through the array until we find the first vowel. If you have more questions about this, bother me!
return word | ||
end | ||
|
||
puts "Here is your portmanteau: #{run_generator}" |
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 do this differently. I would have this puts statement at the end of the run_generator
method, and I would have just called run_generator
on this line instead.
Portmanteau Generator
Congratulations! You're submitting your assignment.
Comprehension Questions
is_vowel?
method affect your project?