Re:Zig: a system language which prioritizes optimality, safe...
by naasking on Monday August 29, 2016 @07:55AM
(#12381272)
I actually prefer a ternary arrangement that lets you chain arbitrary such expressions like a truth table:
[ Parent
| on HN ]
Re:Zig: a system language which prioritizes optimality, safe...
by drjeats on Monday August 29, 2016 @12:39PM
(#12383099)
I 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;