gux/tests/vars_and_consts.gux

48 lines
489 B
Plaintext
Raw Normal View History

var x : int = 4;
var y := 3.2;
assert x == 4;
assert x != 5;
assert y == 3.2;
assert y != 3.1;
var a := (b := (c := 4));
assert a == 4;
assert b == 4;
assert c == 4;
a = 9;
assert a == 9;
var u := 0;
var v := 0;
u = (v = 17);
assert u == 17;
assert v == 17;
# SCOPES
# ======
var a0 := 42;
{
assert a0 == 42;
var a0 := 3;
assert a0 == 3;
{
var a0 := 777;
assert a0 == 777;
}
{
var a0 := 19;
assert a0 == 19;
}
assert a0 == 3;
}
assert a0 == 42;