What is the difference between immutable and mutable borrows

Immutable borrows allow read-only access, while mutable borrows allow modification but require exclusive access to the data.

Immutable borrows (&T) let you read data without changing it, while mutable borrows (&mut T) let you modify the data but prevent any other borrows from existing at the same time.

fn main() {
    let mut number = 5;
    
    // Immutable borrow: can read, cannot write
    let immutable_ref = &number;
    println!("Read: {}", immutable_ref);
    
    // Mutable borrow: can read and write, exclusive access
    let mutable_ref = &mut number;
    *mutable_ref = 10;
    println!("Modified: {}", mutable_ref);
}