Created
January 29, 2013 00:17
-
-
Save charlietanksley/4660535 to your computer and use it in GitHub Desktop.
Ruby idioms?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def example(arg=nil) | |
a = [1, 2] | |
return a.reverse if arg | |
a | |
end | |
# OR | |
def example(arg=nil) | |
a = [1, 2] | |
if arg | |
a = a.reverse | |
end | |
a | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment