Skip to content

Instantly share code, notes, and snippets.

@kristoff-it
Created May 15, 2019 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristoff-it/3209b6c243643fbcdfbd25c3d38d79d3 to your computer and use it in GitHub Desktop.
Save kristoff-it/3209b6c243643fbcdfbd25c3d38d79d3 to your computer and use it in GitHub Desktop.
const std = @import("std");
pub fn main() !void {
const oh = error {
no,
};
var x: oh!u8 = oh.no;
if (x) |_| {
std.debug.warn("got the value");
} else |err| switch (err) {
oh.no => std.debug.warn("oh no!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment