Skip to content

Instantly share code, notes, and snippets.

@MatejLach
Created August 4, 2014 16:24
Show Gist options
  • Save MatejLach/b574e503dfdb4665fd1f to your computer and use it in GitHub Desktop.
Save MatejLach/b574e503dfdb4665fd1f to your computer and use it in GitHub Desktop.
How to use tuples in Rust...
fn main() {
let date = ("Today", 4i, 8i, 2014i); // simple tuple
println!("{}", date);
let (wd, d, m, y) = ("Today", 4i, 8i, 2014i); // destructuring let
println!("{} is {}/{}/{}", wd, d, m, y); // accessing individual variables from the tuple
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment