Skip to content

Instantly share code, notes, and snippets.

@dumindu
Last active September 25, 2016 01:14
Show Gist options
  • Save dumindu/0a442f5062ea5d1a27a9 to your computer and use it in GitHub Desktop.
Save dumindu/0a442f5062ea5d1a27a9 to your computer and use it in GitHub Desktop.
let a = (1, 1.5, true, 'a', "Hello, world!");
// a.0 = 1, a.1 = 1.5, a.2 = true, a.3 = 'a', a.4 = "Hello, world!"
let b: (i32, f64) = (1, 1.5);
let (c, d) = b; // c = 1, d = 1.5
let (e, _, _, _, f) = a; //e = 1, f = "Hello, world!", _ indicates not interested of that item
let g = (0,); //single-element tuple
let h = (b, (2, 4), 5); //((1, 1.5), (2, 4), 5)
println!("{:?}", a); //(1, 1.5, true, 'a', "Hello, world!")
println!("{:#?}", a);
// (
// 1,
// 1.5,
// true,
// 'a',
// "Hello, world!"
// )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment