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