Skip to content

Conversation

@AlexRichards9595
Copy link

No description provided.


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

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