Skip to content
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

Aaron's solution #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Add9Sus4
Copy link

@Add9Sus4 Add9Sus4 commented Jan 7, 2016

No description provided.

@sjreich
Copy link
Contributor

sjreich commented Jan 8, 2016

I'd say give this one another shot. Use two spaces to indent. And see if you can't substantially reduce the amount of code, and avoid the need for the return keyword.

@sjreich
Copy link
Contributor

sjreich commented Jan 9, 2016

Looks a lot better. 👍

If you call a #split on the string first, you'll end up with an array of words, and then your regex can be a lot simpler.

Also, === is probably better than =~ here. Whereas the latter returns the index of the first match, which can be cast into a boolean, the former returns a boolean directly. Just remember that it's a regexp method, so the regexp has to go on the left side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants