观点/教程 Creating arbitrary error values by using error.Something syntax下面两种方式是等价的: 1 2 consterr=error.FileNotFound;consterr=(error{FileNotFound}).FileNotFound; Errors and Zig主要讲述了 Zig 中如何处理错误,如何携带上下文信息 1 2 3 4 5 6 7 8 9 varx=trythingThatCouldFail();if(thingThatCouldFail())|good_value|{x=good_value;break;}else|_|{// do something that should fix it for the next time tries-=1;} Zig Bits 0x2: Using defer to defeat memory leak...