constant_identifier_cannot_change.zig (236B) - Raw
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