22 lines
260 B
Plaintext
22 lines
260 B
Plaintext
|
# Tests shadowing of arguments and local variables
|
||
|
# across functions
|
||
|
import std;
|
||
|
|
||
|
|
||
|
fn first(x: int): int {
|
||
|
var y = x;
|
||
|
y = y + 1;
|
||
|
return y;
|
||
|
}
|
||
|
|
||
|
|
||
|
fn second(x: int): int {
|
||
|
var y = first(x);
|
||
|
y = y + 1;
|
||
|
return y;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
print(second(0)); # 2
|