Handle overflow and underflow - overflowing



examples/numbers/handle-overflow-overflowing-add/src/main.rs
fn main() {
    let mut num: i8 = 126;
    println!("{num}");

    let mut ok;

    (num, ok) = num.overflowing_add(1);
    println!("{num} {ok}");

    (num, ok) = num.overflowing_add(1);
    println!("{num} {ok}");
}

126
127 false
-128 true