Rivoreo Source Code Repositories
src.rivoreo.one
/
compiler-explorer
/
c1ae4aa503a056215dcbf58f7a42e5b0104001a5
/
.
/
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
()
}