mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 09:02:32 +00:00
15 lines
332 B
Zig
15 lines
332 B
Zig
const math = @import("std").math;
|
|
const print = @import("std").debug.print;
|
|
pub fn main() !void {
|
|
var byte: u8 = 255;
|
|
|
|
byte = if (math.add(u8, byte, 1)) |result| result else |err| {
|
|
print("unable to add one: {s}\n", .{@errorName(err)});
|
|
return err;
|
|
};
|
|
|
|
print("result: {}\n", .{byte});
|
|
}
|
|
|
|
// exe=fail
|