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

Alex richards solution #108

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

Conversation

AlexRichards9595
Copy link

No description provided.

end

def fetch_the_dog(input)
#implement your solution here
input.reject { |e| e != "dog" }
Copy link
Member

Choose a reason for hiding this comment

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

I think this returns an array with one element (the "dog"), but I wouldn't expect the result to be an array.

Copy link
Member

Choose a reason for hiding this comment

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

Oops. I was wrong. Ignore that ^

Completely different nitpick: reject and != are both "negative" in a sense, making this a double negative in my opinion. Can this be rephrased positively?

challenge.rb Outdated
end

def fetch_the_first_two(input)
#implement your solution here
input[0,2]
Copy link
Member

Choose a reason for hiding this comment

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

This totally works and [] has great flexibility. input.first(2) would be clearer to the next reader, though.

…t method, but the instructions say that we can only use each method once. But now I realized I used the reject method twice anyways so it doesn't matter
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