Skip to content

Instantly share code, notes, and snippets.

@dumindu
Last active September 25, 2016 01:43
Show Gist options
  • Save dumindu/0c95b62919fd7215238b to your computer and use it in GitHub Desktop.
Save dumindu/0c95b62919fd7215238b to your computer and use it in GitHub Desktop.
let a: [i32; 4] = [1, 2, 3, 4];//Parent Array
let b: &[i32] = &a; //Slicing whole array
let c = &a[0..4]; // From 0th position to 4th(excluding)
let d = &a[..]; //Slicing whole array
let e = &a[1..3]; //[2, 3]
let e = &a[1..]; //[2, 3, 4]
let e = &a[..3]; //[1, 2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment