rust armanazi error [E0596]: cannot borrow `x` as mutable, as it is not declared as mutable

The error message "cannot borrow x as mutable, as it is not declared as mutable" in Rust (specifically the E0596 error) occurs when you try to mutate a variable that is not declared as mutable. In Rust, variables are immutable by default, meaning that you cannot change their value once they are assigned. To fix this error, you need to declare the variable as mutable using the mut keyword. Here's an example:

fn main() {
    let mut x = 5; // Declare `x` as mutable
    x = 10; // Now you can change the value of `x`
    println!("x: {}", x);
}

In this example, the variable x is declared as mutable by adding mut before the variable name. This allows you to change its value later in the code.