-
-
Save anonymous/bc0f756e26f1762beab3 to your computer and use it in GitHub Desktop.
which code is better ?
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
# Survey: | |
# which of the following two equivalent peices of code do you find most pleasing to the eye ? | |
# | |
range = offset == 0 ? (0..23) : (offset > 0 ? (offset..23) : (0..(23-offset))) | |
# | |
# Or | |
# | |
range = case offset | |
when > 0 | |
(offset..23) | |
when < 0 | |
(0..(23 - offset)) | |
else | |
(0..23) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment