In this chapter, only immutable examples of tuples and arrays are given, I suggest to also give examples of mutable tuples and arrays. Also, when a tuple or array is copied, a deep copy is made (unlike in Python for example), it would be better if that would be made clear.
For instance:
let mut a = (1, "2", 3, 4, 5);
let mut b = a;
a.0 = 3;
b.1 = "3";
println!("The value of a is: {:?}", a);
println!("The value of b is: {:?}", b);
let mut a = [1, 2, 3, 4, 5];
let mut b = a;
a[0] = 3;
b[1] = 3;
println!("The value of a is: {:?}", a);
println!("The value of b is: {:?}", b);
URL to the section(s) of the book with this problem:
https://rust-book.cs.brown.edu/ch03-02-data-types.html
In this chapter, only immutable examples of tuples and arrays are given, I suggest to also give examples of mutable tuples and arrays. Also, when a tuple or array is copied, a deep copy is made (unlike in Python for example), it would be better if that would be made clear.
For instance: