Logo

Programming-Idioms

History of Idiom 117 > diff from v18 to v19

Edit summary for version 19 by :
New Rust implementation by user [Yonash]

Version 18

2016-02-16, 19:42:06

Version 19

2016-02-17, 03:47:57

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);
}

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