Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Totally. In fact, if expressions are the very first example of “if” in the Zig manual

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#



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: