diff --git a/functions/functions1.rs b/functions/functions1.rs index 3004363..77973c6 100644 --- a/functions/functions1.rs +++ b/functions/functions1.rs @@ -4,7 +4,9 @@ fn main() { call_me(); } - +fn call_me() { + println!("thank you for calling me :)"); +} diff --git a/functions/functions2.rs b/functions/functions2.rs index 97ed8f1..4471ccd 100644 --- a/functions/functions2.rs +++ b/functions/functions2.rs @@ -4,7 +4,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/functions/functions3.rs b/functions/functions3.rs index 3dba67c..686c975 100644 --- a/functions/functions3.rs +++ b/functions/functions3.rs @@ -1,7 +1,7 @@ // Make me compile! Scroll down for hints :) fn main() { - call_me(); + call_me(5); } fn call_me(num: i32) { diff --git a/functions/functions4.rs b/functions/functions4.rs index e514b84..4b0d923 100644 --- a/functions/functions4.rs +++ b/functions/functions4.rs @@ -8,7 +8,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/functions/functions5.rs b/functions/functions5.rs index a8d7cef..78f8ebb 100644 --- a/functions/functions5.rs +++ b/functions/functions5.rs @@ -6,7 +6,7 @@ fn main() { } fn square(num: i32) -> i32 { - num * num; + num * num } diff --git a/variables/variables1.rs b/variables/variables1.rs index e0ad5de..4be88a3 100644 --- a/variables/variables1.rs +++ b/variables/variables1.rs @@ -1,7 +1,7 @@ // Make me compile! Scroll down for hints :) fn main() { - x = 5; + let x = 5; println!("x has the value {}", x); } diff --git a/variables/variables2.rs b/variables/variables2.rs index ca02438..b592da3 100644 --- a/variables/variables2.rs +++ b/variables/variables2.rs @@ -1,7 +1,7 @@ // Make me compile! Scroll down for hints :) fn main() { - let x; + let x = 10; if x == 10 { println!("Ten!"); } else { diff --git a/variables/variables3.rs b/variables/variables3.rs index ec55a95..0be8cb8 100644 --- a/variables/variables3.rs +++ b/variables/variables3.rs @@ -1,7 +1,7 @@ // Make me compile! Scroll down for hints :) fn main() { - let x = 3; + let mut x = 3; println!("Number {}", x); x = 5; println!("Number {}", x); diff --git a/variables/variables4.rs b/variables/variables4.rs index 3f7f937..6334c78 100644 --- a/variables/variables4.rs +++ b/variables/variables4.rs @@ -1,7 +1,7 @@ // Make me compile! Scroll down for hints :) fn main() { - let x: i32; + let x: i32 = 777; println!("Number {}", x); }