-
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 - Maria #45
base: master
Are you sure you want to change the base?
Sockets - Maria #45
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
def get_the_vowel(word) | ||
word.length > 1 && word =~ /[aeiou]/ | ||
end | ||
|
||
puts "Please enter your first word" | ||
first_word = gets.chomp.downcase | ||
until get_the_vowel(first_word) | ||
puts "Please enter a word with 2 or more characters and a vowel" | ||
first_word = gets.chomp.downcase | ||
end | ||
|
||
words = [] | ||
a = first_word.rindex(/[aeiou].*/) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, would love a comment on this part. Most programmers don't choose to solve problems with regular expressions because they are hard to read on their own even if they are very efficient. |
||
word_a = first_word[0...a] | ||
words << word_a | ||
|
||
puts "Please enter your second word" | ||
second_word = gets.chomp.downcase | ||
until get_the_vowel(second_word) | ||
puts "Please enter a word with 2 or more characters and a vowel" | ||
second_word = gets.chomp.downcase | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the indentation is conventionally done like this: second_word = gets.chomp.downcase
until get_the_vowel(second_word)
puts "Please enter a word with 2 or more characters and a vowel"
second_word = gets.chomp.downcase
end |
||
|
||
b = second_word.split(/([aeiou].*)/) | ||
word_b = b[1] | ||
words << word_b | ||
|
||
puts "Word #{word_a} + #{word_b} is #{words.join("")}" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Read our instructions carefully! We asked for 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.
Very fancy! Could use a comment though!