Sum and product of an array: Difference between revisions
Content added Content deleted
(added zig) |
m (→{{header|RPL}}) |
||
Line 2,813: | Line 2,813: | ||
[ 2 4 8 -5 ] SUMPR |
[ 2 4 8 -5 ] SUMPR |
||
</syntaxhighlight> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 2,819: | Line 2,818: | ||
1: -320 |
1: -320 |
||
</pre> |
</pre> |
||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
<syntaxhighlight lang="ruby">arr = [1,2,3,4,5] # or ary = *1..5, or ary = (1..5).to_a |
<syntaxhighlight lang="ruby">arr = [1,2,3,4,5] # or ary = *1..5, or ary = (1..5).to_a |