Skip to content

Commit 8f50e70

Browse files
committed
Added method sum() to Range pod
1 parent c328b06 commit 8f50e70

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/Type/Range.pod6

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,12 @@ by not actually generating the list if it is not necessary.
181181
Performs the same function as C<Range.list.roll>, but attempts to optimize
182182
by not actually generating the list if it is not necessary.
183183
184+
=head2 method sum
185+
186+
multi method sum() returns Numeric:D
187+
188+
Returns the sum of all elements in the Range. Throws X::Str::Numeric if an element can not be coerced into Numeric.
189+
190+
(1..10).sum #55
191+
184192
=end pod

0 commit comments

Comments
 (0)