Don't understand of syntax of code block after function being a part of the function

Hello! I’m new here and to Zig. I’m looking through zbox at a function called row and the opening { is closed with a } before its return statement here, and I just can’t make heads or tails of this. The function is able to return, and if the assertion right before fails, it does so inside of the row function. I want to understand how this code block is a part of the row function so that I can understand basic Zig syntax.

Also I have a fork of zbox that can compile against Zig Master here. Seems a std library change broke the other one.

It’s a labeled block which determines the type the fuction returns.

https://ziglang.org/documentation/master/#blocks

The only thing to understand about syntax here is that types are just values in zig (albeit values which only exist at compile time), so it is perfectly legal to put an expression (in this case, a labeled block) where a type is expected (in this case, the return type of the function).

1 Like

Thank you so much for the explanation!