DEV Community

Discussion on: Daily Challenge #193 - What's the Real Floor?

Collapse
 
jay profile image
Jay

Rust pattern matching

fn get_real_floor(n: i32) -> i32 {
    match n {
        0 => 0,
        1..=12 => n-1,
        13..=std::i32::MAX => n - 2,
        _ => n
    }
}