Tuples in Rust

Tuples in Rust

Tuples are bunch of different datatypes into single box.

It's so easy. Super easy decoupling of tuples into variables.

main.rs

fn main(){

    let combine_datatypes = (1,2, true, "cool");
    println!("Welcome to tuple world {}", combine_datatypes.0);
    

    // So simply store your tuple values into variables, just WOW!
    let (a,b,c,d) = combine_datatypes;
    println!("WOW! It's amazing {0} ", d);
}

Wow!

Github: https://github.com/eshaikhahmed/rust_learnings

 

Ejaz Shaikh

I'm passionate about freelancing, technology and healthy lifestyle. I enjoy writing code and writing about code.

Something awesome will come here..