Scopes: can not change variables in function from matches, conditionals or loops
bug: values in same function scope are not writable from matches, conditionals or loops. Additionally, one can not write into variables of higher scope. We need to clarify the syntax for this.
expect: It should be possible to write values in functions.
code: input
let x = 4
let y = 0
let z = 0
let a = 4
fn demo
if test 1 == 1
let x += 1
end
echo "x:" $x
if test $x != 5
echo "x broken"
end
for i in {0..=4}
let z += 1
end
echo "z:" $z
if test $z != 5
echo "z broken"
end
match $a
case 4; let a += 1
case _; echo "FAIL"
end
echo "a:" $a
if test $a != 5
echo "a broken"
end
#echo $y
#while test $y -lt 5
# let y += 1 # BROKEN: does not update y
# #echo $y
#end
#echo "y:" $y
#if test $y != 5
# echo "y broken"
#end
end
demo
echo $x
echo $y
echo $z
echo $a
actual: output
x: 4
x broken
z: 0
z broken
a: 4
a broken
4
0
0
4
expect: output
x: 5
y: 5
z: 5
a: 5
5
5
5
5
version: e033ca1c
interaction: none