Skip to content

Instantly share code, notes, and snippets.

@borisd
Created January 8, 2014 09:15
Show Gist options
  • Save borisd/8313938 to your computer and use it in GitHub Desktop.
Save borisd/8313938 to your computer and use it in GitHub Desktop.
# Your code
def foo(a,b,c)
if a > b
return a
end
end
# One line
def foo(a,b,c)
return a if a > b
end
# Better one line
def foo(a,b,c)
a if a > b
end
# Best one line
def foo(a,b,c)
[a,b,c].max
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment