Created
August 4, 2014 16:24
-
-
Save MatejLach/b574e503dfdb4665fd1f to your computer and use it in GitHub Desktop.
How to use tuples in Rust...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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