Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,939 questions

51,876 answers

573 users

How to change elements of a tuple in Rust

1 Answer

0 votes
fn main() {
    let mut tuple = (17, "rust", 3.14, -9);
 
    println!("tuple = {:?}", tuple);
     
    println!("tuple.0 = {}", tuple.0);
    println!("tuple.1 = {}", tuple.1);
    println!("tuple.2 = {}", tuple.2);
    println!("tuple.3 = {}", tuple.3);
    
    
    tuple.2 = 73.9835;
    tuple.3 = 18900;
    
    println!("tuple = {:?}", tuple);
}
 
 
 
 
 
/*
run:
 
tuple = (17, "rust", 3.14, -9)
tuple.0 = 17
tuple.1 = rust
tuple.2 = 3.14
tuple.3 = -9
 
*/

 



answered May 3, 2023 by avibootz

Related questions

3 answers 176 views
2 answers 112 views
112 views asked May 3, 2023 by avibootz
1 answer 76 views
76 views asked May 3, 2023 by avibootz
1 answer 111 views
3 answers 197 views
1 answer 107 views
...