Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

rust sum vector

// still waiting for grepper to add rust syntax highlighting

fn main() {
    let v = vec![1, 2, 3, 4, 5];
    let sum: u8 = a.iter().sum();
    println!("the total sum is: {}", sum);  // the total sum is: 15
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #rust #sum #vector
ADD COMMENT
Topic
Name
5+1 =