Sum of Array: Difference between revisions
Content deleted Content added
OCaml solution |
→[[Ruby]]: Less eww. |
||
Line 291: | Line 291: | ||
[[Category:Ruby]] |
[[Category:Ruby]] |
||
arr = [1,2,3,4,5] |
|||
sum = |
sum = arr.inject { |sum, item| sum + item } |
||
# => 15 |
|||
== [[Scala]]== |
== [[Scala]]== |