Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Get Values Out Of A Tuple In Rust

This is how to access the values of a rust tuple directly

rust
fn main() {
      let characters: (char, char, char) = ('a', 'b', 'c');

      println!("The second character is: {}", characters.1)
  }
results start

*** Destructuring

And this is how to do it with destructuring

rust
fn main() {
      let numbers: (i32, f64, i32) = (500, 6.4, 1);

      let (x, y, z) = numbers;

      println!("The value of y is: {}", y);
  }
results start