4 ms·
Totally. In fact, if expressions are the very first example of “if” in the Zig manual https://ziglang.org/documentation/master/#if https://ziglang.org/document
by kbd 4y ago
Totally. In fact, if expressions are the very first example of “if” in the Zig manual
https://ziglang.org/documentation/master/#if https://ziglang.org/documentation/master/#if
Also, Zig is so into expressions over statements that they plan to remove “function definition as statement”, which I think is awesome. In other words, conceptually function definition is a compile-time expression that creates the function.
Edit: here’s that Zig rfc:
https://github.com/ziglang/zig/issues/1717# https://github.com/ziglang/zig/issues/1717#