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