| ... | ... | @@ -760,7 +760,7 @@ pub fn main() void { |
| 760 | 760 | <tr> |
| 761 | 761 | <th scope="row">{#syntax#}void{#endsyntax#}</th> |
| 762 | 762 | <td>(none)</td> |
| 763 | | <td>0 bit type</td> |
| 763 | <td>Always the value {#syntax#}void{}{#endsyntax#}</td> |
| 764 | 764 | </tr> |
| 765 | 765 | <tr> |
| 766 | 766 | <th scope="row">{#syntax#}noreturn{#endsyntax#}</th> |
| ... | ... | @@ -1061,7 +1061,7 @@ fn addOne(number: i32) i32 { |
| 1061 | 1061 | <p> |
| 1062 | 1062 | Test declarations contain the {#link|keyword|Keyword Reference#} {#syntax#}test{#endsyntax#}, followed by an |
| 1063 | 1063 | optional name written as a {#link|string literal|String Literals and Unicode Code Point Literals#}, followed |
| 1064 | | by a {#link|block|blocks#} containing any valid Zig code that is allowed in a {#link|function|Functions#}. |
| 1064 | by a {#link|block|Blocks#} containing any valid Zig code that is allowed in a {#link|function|Functions#}. |
| 1065 | 1065 | </p> |
| 1066 | 1066 | <aside> |
| 1067 | 1067 | By convention, non-named tests should only be used to {#link|make other tests run|Nested Container Tests#}. |
| ... | ... | @@ -4024,7 +4024,7 @@ test "call foo" { |
| 4024 | 4024 | {#code_end#} |
| 4025 | 4025 | {#header_close#} |
| 4026 | 4026 | |
| 4027 | | {#header_open|blocks#} |
| 4027 | {#header_open|Blocks#} |
| 4028 | 4028 | <p> |
| 4029 | 4029 | Blocks are used to limit the scope of variable declarations: |
| 4030 | 4030 | </p> |
| ... | ... | @@ -4088,6 +4088,22 @@ test "separate scopes" { |
| 4088 | 4088 | } |
| 4089 | 4089 | {#code_end#} |
| 4090 | 4090 | {#header_close#} |
| 4091 | |
| 4092 | {#header_open|Empty Blocks#} |
| 4093 | <p>An empty block is equivalent to {#syntax#}void{}{#endsyntax#}:</p> |
| 4094 | {#code_begin|test|empty_block#} |
| 4095 | const std = @import("std"); |
| 4096 | const expect = std.testing.expect; |
| 4097 | |
| 4098 | test { |
| 4099 | const a = {}; |
| 4100 | const b = void{}; |
| 4101 | try expect(@TypeOf(a) == void); |
| 4102 | try expect(@TypeOf(b) == void); |
| 4103 | try expect(a == b); |
| 4104 | } |
| 4105 | {#code_end#} |
| 4106 | {#header_close#} |
| 4091 | 4107 | {#header_close#} |
| 4092 | 4108 | |
| 4093 | 4109 | {#header_open|switch#} |
| ... | ... | @@ -11987,7 +12003,7 @@ fn readU32Be() u32 {} |
| 11987 | 12003 | {#syntax#}break{#endsyntax#} can be used with a block label to return a value from the block. |
| 11988 | 12004 | It can also be used to exit a loop before iteration completes naturally. |
| 11989 | 12005 | <ul> |
| 11990 | | <li>See also {#link|blocks#}, {#link|while#}, {#link|for#}</li> |
| 12006 | <li>See also {#link|Blocks#}, {#link|while#}, {#link|for#}</li> |
| 11991 | 12007 | </ul> |
| 11992 | 12008 | </td> |
| 11993 | 12009 | </tr> |