Rivoreo Source Code Repositories
src.rivoreo.one
/
compiler-explorer
/
3b8aacc67494479aed8fee344ea8a9f3f69f15f3
/
.
/
examples
/
rust
/
Sum_over_array.rs
blob: a9e6f6ae2e0a14e0525cf7c308d551ca340026e2 [
file
] [
log
] [
blame
] [
raw
]
pub
fn
sum_array_loop
(
input
:
&[
i32
])
->
i32
{
let
mut
sum
:
i32
=
0
;
for
i in
0.
.
input
.
len
()
{
sum
+=
input
[
i
];
}
sum
}
pub
fn
sum_array_iterator
(
input
:
&[
i32
])
->
i32
{
input
.
iter
().
sum
()
}