20 lines
319 B
Plaintext
20 lines
319 B
Plaintext
# Tests var parameters. TODO: They don't actually exist yet, they're just checked statically
|
|
|
|
import std;
|
|
|
|
|
|
operator `+=`(a: var int, b: int) {
|
|
a = a + b;
|
|
}
|
|
|
|
|
|
fn plusOne(x: var int): int {
|
|
x += 1;
|
|
return x;
|
|
}
|
|
|
|
|
|
var x = 5;
|
|
print(plusOne(x));
|
|
# plusOne(38); # If you uncomment this, the compiler errors out!
|