From 6f5a483d360948756512d94dc0c26cb87d12d5b5 Mon Sep 17 00:00:00 2001
From: Yuhua Mai <yuhua@urbandoor.com>
Date: Thu, 14 May 2020 00:04:12 -0700
Subject: [PATCH] Exercises

---
 Cargo.lock                        | 2 +-
 exercises/functions/functions1.rs | 4 ++--
 exercises/functions/functions2.rs | 4 +---
 exercises/functions/functions3.rs | 4 +---
 exercises/functions/functions4.rs | 6 ++----
 exercises/functions/functions5.rs | 4 +---
 exercises/if/if1.rs               | 3 +--
 exercises/variables/variables1.rs | 4 +---
 exercises/variables/variables2.rs | 4 +---
 exercises/variables/variables3.rs | 4 +---
 exercises/variables/variables4.rs | 4 +---
 exercises/variables/variables5.rs | 4 +---
 12 files changed, 14 insertions(+), 33 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index a08dee5..52c8ed4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -592,7 +592,7 @@ dependencies = [
 
 [[package]]
 name = "rustlings"
-version = "2.2.1"
+version = "3.0.0"
 dependencies = [
  "assert_cmd 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/exercises/functions/functions1.rs b/exercises/functions/functions1.rs
index 3112527..5f067be 100644
--- a/exercises/functions/functions1.rs
+++ b/exercises/functions/functions1.rs
@@ -1,8 +1,8 @@
 // functions1.rs
 // Make me compile! Execute `rustlings hint functions1` for hints :)
 
-// I AM NOT DONE
-
 fn main() {
     call_me();
 }
+
+fn call_me() {}
\ No newline at end of file
diff --git a/exercises/functions/functions2.rs b/exercises/functions/functions2.rs
index 108ba38..cfc3cc1 100644
--- a/exercises/functions/functions2.rs
+++ b/exercises/functions/functions2.rs
@@ -1,13 +1,11 @@
 // functions2.rs
 // Make me compile! Execute `rustlings hint functions2` for hints :)
 
-// I AM NOT DONE
-
 fn main() {
     call_me(3);
 }
 
-fn call_me(num) {
+fn call_me(num: i32) {
     for i in 0..num {
         println!("Ring! Call number {}", i + 1);
     }
diff --git a/exercises/functions/functions3.rs b/exercises/functions/functions3.rs
index e3c1bf7..a818d1f 100644
--- a/exercises/functions/functions3.rs
+++ b/exercises/functions/functions3.rs
@@ -1,10 +1,8 @@
 // functions3.rs
 // Make me compile! Execute `rustlings hint functions3` for hints :)
 
-// I AM NOT DONE
-
 fn main() {
-    call_me();
+    call_me(5);
 }
 
 fn call_me(num: i32) {
diff --git a/exercises/functions/functions4.rs b/exercises/functions/functions4.rs
index 58637e4..df4dd66 100644
--- a/exercises/functions/functions4.rs
+++ b/exercises/functions/functions4.rs
@@ -4,14 +4,12 @@
 // This store is having a sale where if the price is an even number, you get
 // 10 Rustbucks off, but if it's an odd number, it's 3 Rustbucks off.
 
-// I AM NOT DONE
-
 fn main() {
-    let original_price = 51;
+    let original_price = 52;
     println!("Your sale price is {}", sale_price(original_price));
 }
 
-fn sale_price(price: i32) -> {
+fn sale_price(price: i32) -> i32 {
     if is_even(price) {
         price - 10
     } else {
diff --git a/exercises/functions/functions5.rs b/exercises/functions/functions5.rs
index d22aa6c..059e929 100644
--- a/exercises/functions/functions5.rs
+++ b/exercises/functions/functions5.rs
@@ -1,13 +1,11 @@
 // functions5.rs
 // Make me compile! Execute `rustlings hint functions5` for hints :)
 
-// I AM NOT DONE
-
 fn main() {
     let answer = square(3);
     println!("The answer is {}", answer);
 }
 
 fn square(num: i32) -> i32 {
-    num * num;
+    num * num
 }
diff --git a/exercises/if/if1.rs b/exercises/if/if1.rs
index 9086754..bcc06fd 100644
--- a/exercises/if/if1.rs
+++ b/exercises/if/if1.rs
@@ -1,13 +1,12 @@
 // if1.rs
 
-// I AM NOT DONE
-
 pub fn bigger(a: i32, b: i32) -> i32 {
     // Complete this function to return the bigger number!
     // Do not use:
     // - another function call
     // - additional variables
     // Execute `rustlings hint if1` for hints
+    if a > b { a } else { b }
 }
 
 // Don't mind this for now :)
diff --git a/exercises/variables/variables1.rs b/exercises/variables/variables1.rs
index 4a3af73..db85e7e 100644
--- a/exercises/variables/variables1.rs
+++ b/exercises/variables/variables1.rs
@@ -6,9 +6,7 @@
 // even after you already figured it out. If you got everything working and
 // feel ready for the next exercise, remove the `I AM NOT DONE` comment below.
 
-// I AM NOT DONE
-
 fn main() {
-    x = 5;
+    let x = 5;
     println!("x has the value {}", x);
 }
diff --git a/exercises/variables/variables2.rs b/exercises/variables/variables2.rs
index 7774a8f..25d90e2 100644
--- a/exercises/variables/variables2.rs
+++ b/exercises/variables/variables2.rs
@@ -1,10 +1,8 @@
 // variables2.rs
 // Make me compile! Execute the command `rustlings hint variables2` if you want a hint :)
 
-// I AM NOT DONE
-
 fn main() {
-    let x;
+    let x = 11;
     if x == 10 {
         println!("Ten!");
     } else {
diff --git a/exercises/variables/variables3.rs b/exercises/variables/variables3.rs
index 07b1a52..8bd1b57 100644
--- a/exercises/variables/variables3.rs
+++ b/exercises/variables/variables3.rs
@@ -1,11 +1,9 @@
 // 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;
     println!("Number {}", x);
-    x = 5;
+    let x = 5;
     println!("Number {}", x);
 }
diff --git a/exercises/variables/variables4.rs b/exercises/variables/variables4.rs
index 77f1e9a..62fb1c2 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 = 10;
     println!("Number {}", x);
 }
diff --git a/exercises/variables/variables5.rs b/exercises/variables/variables5.rs
index 47a68a5..64cebb7 100644
--- a/exercises/variables/variables5.rs
+++ b/exercises/variables/variables5.rs
@@ -1,11 +1,9 @@
 // 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";
     println!("Number {}", number);
-    number = 3;
+    let number = 3;
     println!("Number {}", number);
 }