-
Notifications
You must be signed in to change notification settings - Fork 90
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
base: master
Are you sure you want to change the base?
Alex richards solution #108
Conversation
end | ||
|
||
def fetch_the_dog(input) | ||
#implement your solution here | ||
input.reject { |e| e != "dog" } |
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.
I think this returns an array with one element (the "dog"), but I wouldn't expect the result to be an array.
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.
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] |
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.
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
No description provided.