Add block expression return type doc
Addresses #11112
Add doc on default return type for block expressions, with test case. I'm not sure it's the most appropriate test case (comparing void to void) but couldn't think of something better, if you have any ideas add them here and I'm happy to fix this up 👍
Maybe try expect(@TypeOf(x) == void); is better.... lmk what you prefer
Maybe
try expect(@TypeOf(x) == void);is better.... lmk what you prefer
I'd prefer that.
@Vexu Updated 👍
@Vexu I've rebased a few times now and each time I get a different failing CI step, anything I need to do here or is it just flaky?
The CI is flaky, as long as one of the steps passes the Generating docgen examples phase then this is good. The bigger issue with this is that it only partially addresses the issue since it is missing a Void Literals section.
missing a Void Literals section.
There's a "void" type section https://ziglang.org/documentation/master/#void and I think concept of literals is fairly common, but I also see a section specifically for anon. struct literals https://ziglang.org/documentation/master/#Anonymous-Struct-Literals
What do you think about me adding a Void Literals section under https://ziglang.org/documentation/master/#void and I can link to it in the doc here https://github.com/ziglang/zig/pull/12496/files#diff-9674f03a76728eff712dfbd966487142bf4103b4a58049ee9696028e890f86bcR4044?
There's a "void" type section https://ziglang.org/documentation/master/#void and I think concept of literals is fairly common, but I also see a section specifically for anon. struct literals https://ziglang.org/documentation/master/#Anonymous-Struct-Literals
What do you think about me adding a Void Literals section under https://ziglang.org/documentation/master/#void and I can link to it in the doc here https://github.com/ziglang/zig/pull/12496/files#diff-9674f03a76728eff712dfbd966487142bf4103b4a58049ee9696028e890f86bcR4044?
Whatever you think works best, as long as it mentions void{} somewhere and says that {} is usually preferred.