about summary refs log tree commit diff
path: root/lang/zig/comptime-vars.zig
blob: c20193d36b99498ac66f4387360eb7e5da42d9ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const std = @import("std");
const expect = std.testing.expect;

test "comptime vars" {
    var x: i32 = 1;
    comptime var y: i32 = 1;

    x += 1;
    y += 1;

    expect(x == 2);
    expect(y == 2);

    if (y != 2)
        @compileError("wrong y value");
}