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

All Tests Pass #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SNMellott
Copy link

Added in all code and made sure that the tests pass.

Added in all code and made sure that the tests pass.
end

def fetch_CD_animals(input)
#implement your solution here
input.grep(/^[cd]/i)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making it hard on yourself! I like the creativity, before using a Regex, can you think of any other methods you might try?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially the use of input.select or input.find_all in order to locate the "c" or "d".

input.find_all {|animal| animal.start_with?('c', 'd')}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect - What you did was fine, just wanted to suggest that regex aren't always the best solution even if they are very powerful (hard to read and maintain).

Copy link
Author

@SNMellott SNMellott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. I think I just kind of went with Regex because I've been doing User password/email authentication on Rails for so long recently.

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