Skip to content
This repository was archived by the owner on Oct 15, 2022. It is now read-only.

Commit 4adee0f

Browse files
committed
fix redeclared variable
1 parent 4783cde commit 4adee0f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/DDG/Goodie/SumOfNaturalNumbers.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ handle remainder => sub {
2929

3030
return if ($1 > $3);
3131

32-
my $sum = ((($3 * ($3 + 1)) / 2)-(($1 * ($1 - 1)) / 2));
33-
my ($from_number, $to_number, $sum) = map { commify($_) } ($1, $3, $sum);
32+
my $sum = commify((($3 * ($3 + 1)) / 2)-(($1 * ($1 - 1)) / 2));
33+
my ($from_number, $to_number) = map { commify($_) } ($1, $3);
3434
my $string_answer = 'Sum of natural numbers from ' . $from_number . ' to ' . $to_number;
3535
return $string_answer, structured_answer => {
3636
data => {

0 commit comments

Comments
 (0)