logoalt Hacker News

Turskaramatoday at 11:50 AM1 replyview on HN

More specifically, Zig will return an error type from the division and if this isn't handled THEN it will panic, kind of like an exception except it can be handled with proper pattern matching.


Replies

ben-schaaftoday at 1:13 PM

I can't find anything related to division returning an error type. Looking at std.math.divExact, rem, mod, add, sub, etc. it looks to me like you're expected to use these if you don't want to panic.

show 1 reply