Logo

Programming-Idioms

History of Idiom 117 > diff from v19 to v20

Edit summary for version 20 by :
[Rust] It was way too complicated.

Version 19

2016-02-17, 03:47:57

Version 20

2016-02-17, 03:49:28

Idiom #117 Get list size

Set n to the number of elements of list x.

Idiom #117 Get list size

Set n to the number of elements of list x.

Code
fn main() {
    let x = [1, 2, 3];
    let _n = x.len();
    println!("Length of list is: {}", _n);
}

Code
let n = x.len();

Doc URL
http://rustbyexample.com/primitives/array.html
Doc URL
http://rustbyexample.com/primitives/array.html