Skip to content

Instantly share code, notes, and snippets.

@hoodie
Forked from anonymous/playground.rs
Created March 9, 2016 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoodie/298e54ed1e1ecd1ee60c to your computer and use it in GitHub Desktop.
Save hoodie/298e54ed1e1ecd1ee60c to your computer and use it in GitHub Desktop.
Shared via Rust Playground
fn main() {
let a = [1,2,3,4,5,6,7,8,9,0];
let b = "hello world!";
let slice_a = &a[6..]; // [7,8,9,0]
let slice_b = &b[6..11]; // "world"
let slice_c = &slice_b[..2]; // "wo"
println!("{:?}", a); println!("{:?}", slice_a);
println!("{:?}", b); println!("{:?}", slice_b); println!("{:?}", slice_c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment