Created
July 25, 2019 23:50
-
-
Save spikegrobstein/462dbf5f82ac1b3cfa638ef32ff5559f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn sum(x: Vec<u32>) -> u32 { | |
x.iter().fold(0, |acc, i| acc + i) | |
} | |
fn main() { | |
let my_vec: Vec<u32> = vec![ 1, 2, 3 ]; | |
println!("sum: {}", sum(my_vec)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment