blob: 370675aca333d609b8038548a20ca8ef4f70a405 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import gleam/io
pub fn main() {
let sum = sum_list([18, 56, 35, 85, 91], 0)
io.debug(sum)
}
fn sum_list(list: List(Int), total: Int) -> Int {
case list {
[first, ..rest] -> sum_list(rest, total + first)
[] -> total
}
}
|