Hacker News new | ask | show | jobs
by mtlynch 587 days ago
Ah, thanks! I tried converting that example to Zig:

https://tars.run/t3eInpPFAgc

Is that the idea?

You can do the same thing wrapping integers with structs, but enum makes it slightly more concise?

1 comments

Yes, that's how it works.

I think in Zig for new types you'd use enums for ints and packed structs for more complex types.