diff --git a/exercises/functions/functions1.rs b/exercises/functions/functions1.rs index 396dd56..42fc7e2 100755 --- a/exercises/functions/functions1.rs +++ b/exercises/functions/functions1.rs @@ -5,10 +5,9 @@ fn main() { call_me(); } +fn call_me() { - - - +} diff --git a/exercises/functions/functions2.rs b/exercises/functions/functions2.rs index 1cf95c3..0b7a2ae 100755 --- a/exercises/functions/functions2.rs +++ b/exercises/functions/functions2.rs @@ -5,7 +5,7 @@ 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 b17543b..1fb2886 100755 --- a/exercises/functions/functions3.rs +++ b/exercises/functions/functions3.rs @@ -2,7 +2,7 @@ // Make me compile! Scroll down for hints :) 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 5baca0e..cd34d12 100755 --- a/exercises/functions/functions4.rs +++ b/exercises/functions/functions4.rs @@ -9,7 +9,7 @@ fn main() { 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 d3ff002..c9764bf 100755 --- a/exercises/functions/functions5.rs +++ b/exercises/functions/functions5.rs @@ -7,7 +7,7 @@ fn main() { } fn square(num: i32) -> i32 { - num * num; + num * num } diff --git a/exercises/if/if1.rs b/exercises/if/if1.rs index 6dd64c0..fc9b1f9 100755 --- a/exercises/if/if1.rs +++ b/exercises/if/if1.rs @@ -7,6 +7,12 @@ pub fn bigger(a: i32, b:i32) -> i32 { // - another function call // - additional variables // Scroll down for hints. + if a > b { + a + } + else { + b + } } // Don't mind this for now :) diff --git a/exercises/primitive_types/primitive_types1.rs b/exercises/primitive_types/primitive_types1.rs index c3d11fe..91734c6 100755 --- a/exercises/primitive_types/primitive_types1.rs +++ b/exercises/primitive_types/primitive_types1.rs @@ -10,7 +10,7 @@ fn main() { println!("Good morning!"); } - let // Finish the rest of this line like the example! Or make it be false! + let is_evening = false; // Finish the rest of this line like the example! Or make it be false! if is_evening { println!("Good evening!"); } diff --git a/exercises/primitive_types/primitive_types2.rs b/exercises/primitive_types/primitive_types2.rs index f5c8f87..2294ab4 100755 --- a/exercises/primitive_types/primitive_types2.rs +++ b/exercises/primitive_types/primitive_types2.rs @@ -14,7 +14,8 @@ fn main() { println!("Neither alphabetic nor numeric!"); } - let // Finish this line like the example! What's your favorite character? + let your_character = '1'; + // Finish this line like the example! What's your favorite character? // Try a letter, try a number, try a special character, try a character // from a different language than your own, try an emoji! if your_character.is_alphabetic() { diff --git a/exercises/primitive_types/primitive_types3.rs b/exercises/primitive_types/primitive_types3.rs index 7ce2226..df4c9c3 100755 --- a/exercises/primitive_types/primitive_types3.rs +++ b/exercises/primitive_types/primitive_types3.rs @@ -3,7 +3,7 @@ // Scroll down for hints! fn main() { - let a = ??? + let a = [0..100]; if a.len() >= 100 { println!("Wow, that's a big array!"); diff --git a/exercises/primitive_types/primitive_types4.rs b/exercises/primitive_types/primitive_types4.rs index 1147cf7..d6e7cdf 100755 --- a/exercises/primitive_types/primitive_types4.rs +++ b/exercises/primitive_types/primitive_types4.rs @@ -5,7 +5,7 @@ fn main() { let a = [1, 2, 3, 4, 5]; - let nice_slice = ??? + let nice_slice = &a[1..4]; if nice_slice == [2, 3, 4] { println!("Nice slice!"); diff --git a/exercises/primitive_types/primitive_types5.rs b/exercises/primitive_types/primitive_types5.rs index ae849b4..00c9d9d 100755 --- a/exercises/primitive_types/primitive_types5.rs +++ b/exercises/primitive_types/primitive_types5.rs @@ -4,7 +4,7 @@ fn main() { let cat = ("Furry McFurson", 3.5); - let /* your pattern here */ = cat; + let (name, age) = cat; println!("{} is {} years old.", name, age); } diff --git a/exercises/primitive_types/primitive_types6.rs b/exercises/primitive_types/primitive_types6.rs index 634e56b..3e2b5bc 100755 --- a/exercises/primitive_types/primitive_types6.rs +++ b/exercises/primitive_types/primitive_types6.rs @@ -5,7 +5,7 @@ fn main() { let numbers = (1, 2, 3); - println!("The second number is {}", ???); + println!("The second number is {}", numbers.1); } diff --git a/exercises/test1.rs b/exercises/test1.rs index a477818..5f1ca28 100644 --- a/exercises/test1.rs +++ b/exercises/test1.rs @@ -10,6 +10,14 @@ // Put your function here! // fn ..... { +fn calculateprice(amount: i32) -> i32 { + if amount <= 40 { + amount*2 + } + else { + amount + } +} // Don't modify this function! #[test] fn verify_test() {