diff --git a/README.md b/README.md index e5f207f..72ce656 100644 --- a/README.md +++ b/README.md @@ -103,20 +103,20 @@ By default in rust **variable are immutable**. If you want to make a variable mu fn main() { /// Immutable variable (will throw an error) let x = 5; - println!("The value of x is: {}", x); //! --> The value of x is: 5 + println!("The value of x is: {}", x); // --> The value of x is: 5 x = 6; // This will throw an error because x is immutable //// Mutable variable let mut x = 5; - println!("The value of x is: {}", x); //! --> The value of x is: 5 + println!("The value of x is: {}", x); // --> The value of x is: 5 x = 6; // This will not throw an error because x is mutable - println!("The value of x is: {}", x); //! --> The value of x is: 6 + println!("The value of x is: {}", x); // --> The value of x is: 6 //// Shadowing variable let x = 5; - println!("The value of x is: {}", x); //! --> The value of x is: 5 + println!("The value of x is: {}", x); // --> The value of x is: 5 let x = x + 1; // This will not throw an error because we are creating a new variable and shadowing the previous one - println!("The value of x is: {}", x); //! --> The value of x is: 6 + println!("The value of x is: {}", x); // --> The value of x is: 6 } ```` @@ -126,7 +126,7 @@ You can also declare a constant variable using the `const` keyword. The **type o fn main() { //// Constants const HEAL_POINTS: u32 = 100_000 * 5; - println!("The value of HEAL_POINTS is: {}", HEAL_POINTS); //! --> The value of HEAL_POINTS is: 500000 + println!("The value of HEAL_POINTS is: {}", HEAL_POINTS); // --> The value of HEAL_POINTS is: 500000 } ```` @@ -138,7 +138,7 @@ fn main() { fn main() { // Convert a string to integer by specifying the type let guess: u32 = "42".parse().expect("Not a number!"); // The type mus be specified (u32) - println!("The value of guess is: {}", guess); //! --> The value of guess is: 42 + println!("The value of guess is: {}", guess); // --> The value of guess is: 42 } ```` @@ -192,7 +192,7 @@ fn main() { /// If statements let number: i32 = 3; if number < 5 { - println!("number smaller than 5"); //! --> condition was true + println!("number smaller than 5"); // --> condition was true } else if number > 25 { println!("number bigger than 25"); } else {