Merge pull request #3 from m1xb3r/main

Completed all functions exercises
This commit is contained in:
m6r 2022-11-17 17:26:33 +01:00 committed by GitHub
commit 54232d0080
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -4,8 +4,8 @@
fn main() {
call_me();
call();
}
fn call_me () {
fn call () {
}

View File

@ -7,7 +7,7 @@ fn main() {
call_me(3);
}
fn call_me(num: u8) {
fn call_me(num:u8) {
for i in 0..num {
println!("Ring! Call number {}", i + 1);
}

View File

@ -4,7 +4,7 @@
fn main() {
call_me(8);
call_me(9);
}
fn call_me(num: u32) {

View File

@ -14,7 +14,7 @@ fn main() {
println!("Your sale price is {}", sale_price(original_price));
}
fn sale_price(price: i32) -> i32 {
fn sale_price(price: i8) -> i8 {
if is_even(price) {
price - 10
} else {
@ -22,6 +22,6 @@ fn sale_price(price: i32) -> i32 {
}
}
fn is_even(num: i32) -> bool {
fn is_even(num: i8) -> bool {
num % 2 == 0
}