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

Here's my solution! #118

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

Here's my solution! #118

wants to merge 1 commit into from

Conversation

mshecket
Copy link

I used a ternary for the letter grade function, and I was going to try to do something fancy with Array.map for the other function, but I ended up doing a regular Array.each loop.

end
}
# Implicit return! Because we can!
shortest
Copy link
Member

Choose a reason for hiding this comment

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

This is very easy to read. 👍

Ruby provides many methods to built-in classes. In particular, all these methods on Enumerable are available to instances of Array.

Consider rewriting this method to sort the input array by the length of the elements, then just plucking off the answer.

Or, if you scan through those Enumerable methods, you might find min_by which basically does the whole thing for you. But what's the fun in that?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks very much for the feedback!

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