From 4d87bc8d58423eda73e4ce50139deada0ddab34e Mon Sep 17 00:00:00 2001 From: Tiago Rinaldi <trinaldi@gmail.com> Date: Thu, 27 Aug 2020 22:31:13 -0300 Subject: [PATCH] Fix variables exercises --- exercises/variables/variables3.rs | 4 +--- exercises/variables/variables4.rs | 4 +--- exercises/variables/variables5.rs | 5 ++--- exercises/variables/variables6.rs | 4 +--- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/exercises/variables/variables3.rs b/exercises/variables/variables3.rs index 30ec48f..7d84709 100644 --- a/exercises/variables/variables3.rs +++ b/exercises/variables/variables3.rs @@ -1,10 +1,8 @@ // variables3.rs // Make me compile! Execute the command `rustlings hint variables3` if you want a hint :) -// I AM NOT DONE - fn main() { - let x = 3; + let mut x = 3; println!("Number {}", x); x = 5; // don't change this line println!("Number {}", x); diff --git a/exercises/variables/variables4.rs b/exercises/variables/variables4.rs index 77f1e9a..f8c7845 100644 --- a/exercises/variables/variables4.rs +++ b/exercises/variables/variables4.rs @@ -1,9 +1,7 @@ // variables4.rs // Make me compile! Execute the command `rustlings hint variables4` if you want a hint :) -// I AM NOT DONE - fn main() { - let x: i32; + let x: i32 = 0; println!("Number {}", x); } diff --git a/exercises/variables/variables5.rs b/exercises/variables/variables5.rs index 5b2c2fa..5cc34c9 100644 --- a/exercises/variables/variables5.rs +++ b/exercises/variables/variables5.rs @@ -1,11 +1,10 @@ // variables5.rs // Make me compile! Execute the command `rustlings hint variables5` if you want a hint :) -// I AM NOT DONE - fn main() { let number = "3"; // don't change this line println!("Number {}", number); - number = 3; + // Shadowing + let number = 3; println!("Number {}", number); } diff --git a/exercises/variables/variables6.rs b/exercises/variables/variables6.rs index 9866691..2ad47aa 100644 --- a/exercises/variables/variables6.rs +++ b/exercises/variables/variables6.rs @@ -1,9 +1,7 @@ // variables6.rs // Make me compile! Execute the command `rustlings hint variables6` if you want a hint :) -// I AM NOT DONE - -const NUMBER = 3; +const NUMBER: i32 = 3; fn main() { println!("Number {}", NUMBER); }