From 28d7dd8fc2ea318100fc5bbea481919ed95c5dfa Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Wed, 11 Jan 2023 16:05:39 +0100 Subject: [PATCH] Next video: orelse + some possible error improvements. --- zig-impl/next-video.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zig-impl/next-video.md b/zig-impl/next-video.md index 3c04295..aca31f3 100644 --- a/zig-impl/next-video.md +++ b/zig-impl/next-video.md @@ -40,3 +40,11 @@ Double returning type => no need for specific return structures. const Timer = std.time.Timer; var timer = try Timer.start(); var duration = timer.read() / 1000000; // ns -> ms + +var value = db.get(key) orelse return error.notHere; + +# There is still room for improvement. + +When the result actually is a single value (anonymous hash). + src/switch.zig:125:37: error: binary operator `|` has whitespace on one side, but not the other. + self.db.fetchSwapRemove(fd) |k,v|{