Meg's Mirrors
zig
about
heads
tags
log
tree
search
Search
zig
doc
langref
constant_identifier_cannot_change.zig
pretty
plain
permalink
blame
history
•
15 lines
•
236 B
1
const x = 1234;
2
3
fn foo() void {
4
// It works at file scope as well as inside functions.
5
const y = 5678;
6
7
// Once assigned, an identifier cannot be changed.
8
y += 1;
9
}
10
11
pub fn main() void {
12
foo();
13
}
14
15
// exe=build_fail