authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-09-03 12:18:12-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-09-03 12:18:12-04:00
log3f273479f8f38fb408181b2ae2fff1acf4278ba1
treee4a469852c929fab205304070ba4d1ce77395663
parent2a9329c9988430cfa11a8bb4b02da0dce8749028
signaturelock-open Commit is signed but in an unrecognized format.

clarify const variables in docs

closes #1200

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

doc/langref.html.in+4-3
......@@ -566,7 +566,7 @@ const c_string_literal =
566566 {#header_close#}
567567 {#header_close#}
568568 {#header_open|Assignment#}
569 <p>Use <code>const</code> to assign a value to an identifier:</p>
569 <p>Use the <code>const</code> keyword to assign a value to an identifier:</p>
570570 {#code_begin|test_err|cannot assign to constant#}
571571const x = 1234;
572572
......@@ -582,7 +582,8 @@ test "assignment" {
582582 foo();
583583}
584584 {#code_end#}
585 <p>If you need a variable that you can modify, use <code>var</code>:</p>
585 <p><code>const</code> applies to all of the bytes that the identifier immediately addresses. {#link|Pointers#} have their own const-ness.</p>
586 <p>If you need a variable that you can modify, use the <code>var</code> keyword:</p>
586587 {#code_begin|test#}
587588const assert = @import("std").debug.assert;
588589
......@@ -1918,7 +1919,7 @@ test "linked list" {
19181919 assert(list2.first.?.data == 1234);
19191920}
19201921 {#code_end#}
1921 {#header_open|struct naming#}
1922 {#header_open|struct Naming#}
19221923 <p>Since all structs are anonymous, Zig infers the type name based on a few rules.</p>
19231924 <ul>
19241925 <li>If the struct is in the initialization expression of a variable, it gets named after