-
Notifications
You must be signed in to change notification settings - Fork 82
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
Sheshtawy #94
base: master
Are you sure you want to change the base?
Sheshtawy #94
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 |
---|---|---|
|
@@ -19,9 +19,17 @@ def run! | |
|
||
|
||
def speak(input) | ||
|
||
#Implement your code here <<<<<<<<< | ||
|
||
upper = /[A-Z]+/ | ||
lower = /[A-Z]?[a-z]+/ | ||
bye = /\A(BYE ?){3}\z/ | ||
response = '' | ||
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. I don't think we need this local variable. Below, you conditionally assign different values to it, but you don't do anything else with |
||
if lower.match(input) | ||
response = 'SPEAK UP SONNY!' | ||
elsif bye.match(input) | ||
response = 'SEE YOU LATER SONNY!' | ||
elsif upper.match(input) | ||
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. What if the input matches none of these regular expressions? I think that would happen if there is no letter in the input. |
||
response = 'NOT SINCE 1964!' | ||
end | ||
end | ||
|
||
private | ||
|
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.
These three regular expressions could be extracted to constants, since they are the same every time this method is called.