3 ms·
I actually prefer a ternary arrangement that lets you chain arbitrary such expressions like a truth table: return (value >= radix) ? error.InvalidChar:
by naasking 10y ago
I actually prefer a ternary arrangement that lets you chain arbitrary such expressions like a truth table:
return (value >= radix) ? error.InvalidChar:
(comeCondition) ? error.OtherError:
...
value;
- drjeats 10y agoI like doing that too, but the Zig syntax doesn't prevent that kind of arrangement, just makes it a bit wider. return if (value >= radix) error.InvalidChar else if (comeCondition) error.OtherError else ... value; or maybe this, but it seems uglier to me: return if (value >= radix) error.InvalidChar else if (comeCondition) error.OtherError ... else value;