functions4 modified

This commit is contained in:
Abhijit Roy 2021-11-23 12:27:17 +05:30
parent dba759e1c6
commit 2e8abe5a8f

View File

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