summaryrefslogtreecommitdiff
path: root/rust/rustlings/exercises/02_functions/functions4.rs
blob: 2c5a3b01aa192cac54227552366230a21053d8e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
fn is_even(num: i64) -> bool {
    num % 2 == 0
}

// TODO: Fix the function signature.
fn sale_price(price: i64) -> i64 {
    if is_even(price) {
        price - 10
    } else {
        price - 3
    }
}

fn main() {
    let original_price = 51;
    println!("Your sale price is {}", sale_price(original_price));
}