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