Skip to content

Instantly share code, notes, and snippets.

@matstc
Created October 21, 2014 13:35
Show Gist options
  • Save matstc/993b82f7a5623710e6fe to your computer and use it in GitHub Desktop.
Save matstc/993b82f7a5623710e6fe to your computer and use it in GitHub Desktop.
Example of heavy if branch
def comment_on_popularity
if !post.stars.empty?
if post.stars.count > 100
"Congratulations. Your post is very popular."
elsif post.stars.count > 50
"Well done. Your post is trending."
else
"Your post is doing well but could use a little attention."
end
else
"Your post is flying under the radar."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment