There is this new programming language V-lang being created by Alex Medvednikov. I'm using V-lang version 0.1.11 currently. I can declare an array in V-lang like below :
a := [1,2,3]
// or, mut a := [1,2,3]
I tried to get the last item of this array like :
>>> a := [1,2,3]
>>> println(a[-1])
V panic: array index out of range: -1/3
>>> println(a[a.len -1])
V panic: array index out of range: -1/3
Each time, it shows :
V panic: array index out of range:
Now just after this, if I try to get the items from the array, then still it shows the same error :
>>> println(a[1])
V panic: array index out of range: -1/3
>>> println(a.len)
V panic: array index out of range: -1/3
Where as, if we tried to get the items from the array before once we have had encountered V panic
, it would have printed the same without any error, like a fresh instance in the terminal :
>>> a := [1,2,3]
>>> println(a.len)
3
>>> println(a[1])
2
Why does V-lang shows V panic
for valid indexing every time after once we encounter V panic
beforehand ?