aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/addWithOverflow_builtin.zig
blob: 39f6c55db11f1a794e3991c6afd83a7e905efffe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const print = @import("std").debug.print;
pub fn main() void {
    const byte: u8 = 255;

    const ov = @addWithOverflow(byte, 10);
    if (ov[1] != 0) {
        print("overflowed result: {}\n", .{ov[0]});
    } else {
        print("result: {}\n", .{ov[0]});
    }
}

// exe=succeed