Logo

Programming-Idioms

History of Idiom 54 > diff from v3 to v4

Edit summary for version 4 by :

Version 3

2015-08-19, 07:55:25

Version 4

2015-08-19, 14:46:09

Idiom #54 Compute sum of integers

Calculate the sum s of integer list x.

Idiom #54 Compute sum of integers

Calculate the sum s of integer list x.

Code
let mut s=0;
for &i in &x
{
    s+=i;
}
Comments bubble
`x.iter().sum()` is currently unstable.