Created
August 31, 2015 10:43
-
-
Save fuksito/341c36ce3169d4ce1817 to your computer and use it in GitHub Desktop.
ruby sum on array
This file contains hidden or 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
> [nil].sum | |
=> 0 | |
> [5,nil].sum | |
TypeError: nil can't be coerced into Fixnum | |
> [nil,5].sum | |
NoMethodError: undefined method `+' for nil:NilClass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment