3 ms·
One more syntax issue: http://andrewkelley.me/post/intro-to-zig.html http://andrewkelley.me/post/intro-to-zig.html shows the const number = parse_u64(str,
by tom_mellior 10y ago
One more syntax issue:
http://andrewkelley.me/post/intro-to-zig.html http://andrewkelley.me/post/intro-to-zig.html shows the
const number = parse_u64(str, 10) %% |err| return err;
pattern and then goes on to say that you can avoid repeating "%% |err| return err" all the time by writing
const number = %return parse_u64(str, 10);
instead. I don't think that's particularly nice; it looks too much like "return the result of the call" when that's only what happens in the error case. I would have expected something more like this:
const number = parse_u64(str, 10) %% return error;
where the compiler would turn "return error" into "|_some_var| return _some_var".