Created
July 2, 2012 19:51
-
-
Save danielmorrison/3035296 to your computer and use it in GitHub Desktop.
if vs case
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
if status_code == 0 | |
# do stuff | |
elsif status_code == 1 | |
# do stuff | |
elsif status_code == 2 | |
# do stuff | |
end | |
case status_code | |
when 0 | |
# do stuff | |
when 1 | |
# do stuff | |
when 2 | |
# do stuff | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment