mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 09:02:32 +00:00
18 lines
344 B
Zig
18 lines
344 B
Zig
const print = @import("std").debug.print;
|
|
|
|
pub fn main() void {
|
|
const result = getNumberOrFail();
|
|
|
|
if (result) |number| {
|
|
print("got number: {}\n", .{number});
|
|
} else |err| {
|
|
print("got error: {s}\n", .{@errorName(err)});
|
|
}
|
|
}
|
|
|
|
fn getNumberOrFail() !i32 {
|
|
return error.UnableToReturnNumber;
|
|
}
|
|
|
|
// exe=succeed
|