diff --git a/exercises/functions/functions1.rs b/exercises/functions/functions1.rs index 31125278..acd3b8b1 100644 --- a/exercises/functions/functions1.rs +++ b/exercises/functions/functions1.rs @@ -1,7 +1,8 @@ // functions1.rs // Make me compile! Execute `rustlings hint functions1` for hints :) -// I AM NOT DONE +fn call_me() -> (){ +} fn main() { call_me(); diff --git a/exercises/functions/functions2.rs b/exercises/functions/functions2.rs index 5721a172..40b5140b 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: i8) { for i in 0..num { println!("Ring! Call number {}", i + 1); } diff --git a/exercises/functions/functions3.rs b/exercises/functions/functions3.rs index ed5f839f..c8b35285 100644 --- a/exercises/functions/functions3.rs +++ b/exercises/functions/functions3.rs @@ -4,7 +4,7 @@ // I AM NOT DONE fn main() { - call_me(); + call_me(5); } fn call_me(num: u32) { diff --git a/exercises/functions/functions4.rs b/exercises/functions/functions4.rs index 58637e4c..b6af7c4b 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; 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 d22aa6c8..d4ceceed 100644 --- a/exercises/functions/functions5.rs +++ b/exercises/functions/functions5.rs @@ -9,5 +9,5 @@ fn main() { } fn square(num: i32) -> i32 { - num * num; + num * num } diff --git a/exercises/if/if1.rs b/exercises/if/if1.rs index 90867545..361b9fc0 100644 --- a/exercises/if/if1.rs +++ b/exercises/if/if1.rs @@ -1,13 +1,16 @@ // 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/if/if2.rs b/exercises/if/if2.rs index 80effbdf..4c1c1ee6 100644 --- a/exercises/if/if2.rs +++ b/exercises/if/if2.rs @@ -9,8 +9,10 @@ pub fn fizz_if_foo(fizzish: &str) -> &str { if fizzish == "fizz" { "foo" + } else if fizzish == "fuzz" { + "bar" } else { - 1 + "baz" } } diff --git a/exercises/move_semantics/move_semantics1.rs b/exercises/move_semantics/move_semantics1.rs index e2f5876d..a95f851a 100644 --- a/exercises/move_semantics/move_semantics1.rs +++ b/exercises/move_semantics/move_semantics1.rs @@ -1,12 +1,10 @@ // move_semantics1.rs // Make me compile! Execute `rustlings hint move_semantics1` for hints :) -// I AM NOT DONE - fn main() { let vec0 = Vec::new(); - let vec1 = fill_vec(vec0); + let mut vec1 = fill_vec(vec0); println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1); diff --git a/exercises/move_semantics/move_semantics2.rs b/exercises/move_semantics/move_semantics2.rs index 888dc529..26a06018 100644 --- a/exercises/move_semantics/move_semantics2.rs +++ b/exercises/move_semantics/move_semantics2.rs @@ -2,12 +2,12 @@ // Make me compile without changing line 13 or moving line 10! // Execute `rustlings hint move_semantics2` for hints :) -// I AM NOT DONE + fn main() { let vec0 = Vec::new(); - let mut vec1 = fill_vec(vec0); + let mut vec1 = fill_vec(vec0.clone()); // Do not change the following line! println!("{} has length {} content `{:?}`", "vec0", vec0.len(), vec0); diff --git a/exercises/variables/variables1.rs b/exercises/variables/variables1.rs index d1af8311..f41da792 100644 --- a/exercises/variables/variables1.rs +++ b/exercises/variables/variables1.rs @@ -2,9 +2,7 @@ // Make me compile! // Execute the command `rustlings hint variables1` if you want a hint :) -// 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 7774a8fb..5cdc7533 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 = 10; if x == 10 { println!("Ten!"); } else { diff --git a/exercises/variables/variables3.rs b/exercises/variables/variables3.rs index 30ec48ff..01220f97 100644 --- a/exercises/variables/variables3.rs +++ b/exercises/variables/variables3.rs @@ -1,11 +1,10 @@ // 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); + let x; x = 5; // don't change this line println!("Number {}", x); } diff --git a/exercises/variables/variables4.rs b/exercises/variables/variables4.rs index 77f1e9ab..cd215f6d 100644 --- a/exercises/variables/variables4.rs +++ b/exercises/variables/variables4.rs @@ -4,6 +4,6 @@ // I AM NOT DONE fn main() { - let x: i32; + let x: i32 = 5; println!("Number {}", x); } diff --git a/exercises/variables/variables5.rs b/exercises/variables/variables5.rs index 175eebb3..e31ab3f2 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 = "T-H-R-E-E"; // don't change this line println!("Spell a Number : {}", number); - number = 3; + let number = 3; println!("Number plus two is : {}", number + 2); } diff --git a/exercises/variables/variables6.rs b/exercises/variables/variables6.rs index 98666914..cfcadd59 100644 --- a/exercises/variables/variables6.rs +++ b/exercises/variables/variables6.rs @@ -3,7 +3,7 @@ // I AM NOT DONE -const NUMBER = 3; +const NUMBER:i32 = 3; fn main() { println!("Number {}", NUMBER); }