aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/constant_identifier_cannot_change.zig
blob: 90e49798a82cc0e9e25e8094c549faf00e8b516e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const x = 1234;

fn foo() void {
    // It works at file scope as well as inside functions.
    const y = 5678;

    // Once assigned, an identifier cannot be changed.
    y += 1;
}

pub fn main() void {
    foo();
}

// exe=build_fail