mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
17 lines
200 B
V
17 lines
200 B
V
[unsafe]
|
|
fn foo() int {
|
|
mut static x := 42
|
|
x++
|
|
return x
|
|
}
|
|
|
|
fn xfoo() int {
|
|
return unsafe { foo() }
|
|
}
|
|
|
|
fn test_static_vars_work() {
|
|
assert xfoo() == 43
|
|
assert xfoo() == 44
|
|
assert xfoo() == 45
|
|
}
|