From 9c58757b4200e3380251f898ec742b6676750bea Mon Sep 17 00:00:00 2001 From: "David E. Perez Negron R." Date: Wed, 25 Oct 2023 19:55:59 -0600 Subject: [PATCH] functions done --- exercises/functions/functions1.rs | 3 ++- exercises/functions/functions2.rs | 3 +-- exercises/functions/functions3.rs | 3 +-- exercises/functions/functions4.rs | 3 +-- exercises/functions/functions5.rs | 3 +-- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/exercises/functions/functions1.rs b/exercises/functions/functions1.rs index 40ed9a0..e505851 100644 --- a/exercises/functions/functions1.rs +++ b/exercises/functions/functions1.rs @@ -3,8 +3,9 @@ // Execute `rustlings hint functions1` or use the `hint` watch subcommand for a // hint. -// I AM NOT DONE fn main() { call_me(); } + +fn call_me(){} diff --git a/exercises/functions/functions2.rs b/exercises/functions/functions2.rs index 5154f34..730c617 100644 --- a/exercises/functions/functions2.rs +++ b/exercises/functions/functions2.rs @@ -3,13 +3,12 @@ // Execute `rustlings hint functions2` or use the `hint` watch subcommand for a // hint. -// I AM NOT DONE fn main() { call_me(3); } -fn call_me(num:) { +fn call_me(num: isize) { for i in 0..num { println!("Ring! Call number {}", i + 1); } diff --git a/exercises/functions/functions3.rs b/exercises/functions/functions3.rs index 74f44d6..49a520c 100644 --- a/exercises/functions/functions3.rs +++ b/exercises/functions/functions3.rs @@ -3,10 +3,9 @@ // Execute `rustlings hint functions3` or use the `hint` watch subcommand for a // hint. -// 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 77c4b2a..96891ce 100644 --- a/exercises/functions/functions4.rs +++ b/exercises/functions/functions4.rs @@ -8,14 +8,13 @@ // Execute `rustlings hint functions4` or use the `hint` watch subcommand for a // hint. -// 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 f1b63f4..a9dd1b5 100644 --- a/exercises/functions/functions5.rs +++ b/exercises/functions/functions5.rs @@ -3,7 +3,6 @@ // Execute `rustlings hint functions5` or use the `hint` watch subcommand for a // hint. -// I AM NOT DONE fn main() { let answer = square(3); @@ -11,5 +10,5 @@ fn main() { } fn square(num: i32) -> i32 { - num * num; + num * num }