Skip to content

Comments

Here's my solution!#118

Open
mshecket wants to merge 1 commit intopaircolumbus:masterfrom
mshecket:master
Open

Here's my solution!#118
mshecket wants to merge 1 commit intopaircolumbus:masterfrom
mshecket:master

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