authorgravatar for michael@michaelbyrne.ioMichael Byrne <michael@michaelbyrne.io> 2021-10-23 15:13:35+11:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-10-23 02:57:20-04:00
logee98d8700818aa667137e3aa580b16df2ba6d680
treee3498482f1fe65d46718031d93132cda309d1fad
parent6aeb6bcc84f48fdc88374fa4a3d5a2b9d0bd147e

Minor rewording of "Shadowing" section within language reference


1 files changed, 4 insertions(+), 3 deletions(-)

doc/langref.html.in+4-3
...@@ -3872,7 +3872,7 @@ test "labeled break from labeled block expression" {...@@ -3872,7 +3872,7 @@ test "labeled break from labeled block expression" {
3872 {#see_also|Labeled while|Labeled for#}3872 {#see_also|Labeled while|Labeled for#}
38733873
3874 {#header_open|Shadowing#}3874 {#header_open|Shadowing#}
3875 <p>It is never allowed for an identifier to "hide" another one by using the same name:</p>3875 <p>Identifiers are never allowed to "hide" other identifiers by using the same name:</p>
3876 {#code_begin|test_err|local shadows declaration#}3876 {#code_begin|test_err|local shadows declaration#}
3877const pi = 3.14;3877const pi = 3.14;
38783878
...@@ -3884,8 +3884,9 @@ test "inside test block" {...@@ -3884,8 +3884,9 @@ test "inside test block" {
3884}3884}
3885 {#code_end#}3885 {#code_end#}
3886 <p>3886 <p>
3887 Because of this, when you read Zig code you can rely on an identifier always meaning the same thing,3887 Because of this, when you read Zig code you can always rely on an identifier to consistently mean
3888 within the scope it is defined. Note that you can, however use the same name if the scopes are separate:3888 the same thing within the scope it is defined. Note that you can, however, use the same name if
3889 the scopes are separate:
3889 </p>3890 </p>
3890 {#code_begin|test|test_scopes#}3891 {#code_begin|test|test_scopes#}
3891test "separate scopes" {3892test "separate scopes" {