MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / main

Function main

03_tuples_arrays/rust/arrays.rs:3–18  ·  view source on GitHub ↗

demo of arrays

()

Source from the content-addressed store, hash-verified

1/// demo of arrays
2
3fn main() {
4 let xs = [1, 2, 3, 4, 5];
5
6 let ys: [i32; 500] = [0; 500];
7 let _ys = [0_u64; 500];
8
9 println!("first element of the array: {}", xs[0]);
10 println!("second element of the array: {}", xs[1]);
11
12 println!("small size: {}", xs.len());
13 println!("big size: {}", ys.len());
14
15 println!("borrow a section of the array as a slice {:?}", &xs[1..3]);
16
17 println!("{}", xs[5]);
18}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected