Tuple (Rust)

202307061629
Status: #idea
Tags: Rust

Tuple (Rust)

fn main() {
    let tup: (i32, f64, u8) = (500, 6.4, 1);
    
    let (x, y, z) = tup; // (x=500, y=6.4, z=1)
    
    let five_hundered = x.0;
    let six_point_four = x.1;
    let one = x.2;
}

References

  1. Data Types
  2. https://rust-book.cs.brown.edu/ch03-02-data-types.html#the-tuple-type