Optionals handle this in zig:
var value: ?T = null;
Write: value = 10;
Read: if (value) |x| x+=1Came to say this. Early in my career I really thought implementing Maybe in any language is necessary but not I know better. Use the idioms and don’t try to make every language something it’s not.
Sure, but this is an example from the article, and pertains to sum types in general, not just Maybe.