Created
August 2, 2017 15:12
-
-
Save ryuchan00/d1c66553e05ab306cd16e2808f27093a to your computer and use it in GitHub Desktop.
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
array = [nil, 1, 2, 3, nil] | |
# nilを削除して計算 | |
p array.compact.inject(&:+) # 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment