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

Attempting to write some Ruby #97

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

Conversation

spudfkc
Copy link

@spudfkc spudfkc commented Mar 1, 2018

#Put your code here!

unless array.nil?
array.min_by { |s| s.length }
Copy link
Member

Choose a reason for hiding this comment

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

nice use of min_by!

theoretically, you could also check for if array. i'd like to call attention to two things.

  1. there's a lot of great options when working in rails - https://stackoverflow.com/questions/885414/a-concise-explanation-of-nil-v-empty-v-blank-in-ruby-on-rails
  2. there's something to keep in mind when using unless.
    http://www.railstips.org/blog/archives/2008/12/01/unless-the-abused-ruby-conditional/

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