Skip to content

Conversation

@lnestor
Copy link

@lnestor lnestor commented May 10, 2018

@jaybobo
Here you go!

Copy link
Member

@jaybobo jaybobo left a comment

Choose a reason for hiding this comment

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

Looks good. See notes.

end
end

def shortest_string(array)
Copy link
Member

Choose a reason for hiding this comment

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

there's a few ways in ruby to complete this in a more concise way. try this one again using .min_by.
https://ruby-doc.org/core-2.5.0/Enumerable.html#method-i-min_by

letsdrill.rb Outdated

#Put your code here!

if integer >= 90
Copy link
Member

Choose a reason for hiding this comment

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

if >= isn't sufficient and you need a 'lower bound', you can also use ranges

example:

case integer
when 80..90
  ...
end

@lnestor
Copy link
Author

lnestor commented May 11, 2018

I made the changes you recommended.


#Put your code here!

array.min_by(&:length)
Copy link
Member

Choose a reason for hiding this comment

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

💯

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.

3 participants