diff options
author | inoas <mail@inoas.com> | 2023-01-31 15:02:24 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2023-02-01 17:29:12 +0000 |
commit | 50862d1acc5c74fbf8de2b46f35c17c9a49057a4 (patch) | |
tree | 7c223d9114484c05293cb4286cafc089e55e2c9d /src | |
parent | 67e9cf8ea21ac829612e6e0ce2488c4748667a2a (diff) | |
download | gleam_stdlib-50862d1acc5c74fbf8de2b46f35c17c9a49057a4.tar.gz gleam_stdlib-50862d1acc5c74fbf8de2b46f35c17c9a49057a4.zip |
product-of-empty-list-of-numbers-could-return-1
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/float.gleam | 2 | ||||
-rw-r--r-- | src/gleam/int.gleam | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/gleam/float.gleam b/src/gleam/float.gleam index 5893b44..1ee175c 100644 --- a/src/gleam/float.gleam +++ b/src/gleam/float.gleam @@ -427,7 +427,7 @@ fn do_sum(numbers: List(Float), initial: Float) -> Float { /// pub fn product(numbers: List(Float)) -> Float { case numbers { - [] -> 0.0 + [] -> 1.0 _ -> do_product(numbers, 1.0) } } diff --git a/src/gleam/int.gleam b/src/gleam/int.gleam index eafbade..7623331 100644 --- a/src/gleam/int.gleam +++ b/src/gleam/int.gleam @@ -465,7 +465,7 @@ fn do_sum(numbers: List(Int), initial: Int) -> Int { /// pub fn product(numbers: List(Int)) -> Int { case numbers { - [] -> 0 + [] -> 1 _ -> do_product(numbers, 1) } } |