-
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 - Kirsten #34
base: master
Are you sure you want to change the base?
Conversation
Portmanteau GeneratorWhat We're Looking For
|
end | ||
|
||
continue = validate(word) | ||
if continue == 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.
could you reduce this loop structure so that you check both the word length and the vowel count? Perhaps with elsif
?
if is_vowel?(temp_array[i]) | ||
vowel_array << i | ||
end | ||
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.
While effective, this solution is doing a lot more work than it needs to. It will take the program less time to run if you just returned the index of the first or last value in the word.
print "Would you like to make another portmanteau (y/n)? " | ||
run_again = gets.chomp | ||
while run_again != "y" && run_again != "n" | ||
print "Please enter \"y\" for yes or \"n\" for no. " |
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 portion never runs because run_again
starts by being set to 'y', so this while
is always skipped
|
||
def is_vowel?(letter) | ||
case letter | ||
when "a", "e", "i", "o", "u", "A", "E", "I", "O", "U" |
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 job catching upper case! .downcase
would also achieve this effect.
Portmanteau Generator
Congratulations! You're submitting your assignment.
Comprehension Questions
is_vowel?
method affect your project?