I have a static size array of length 1, which I am trying to assign a value with index 0.
void main() { int length = 0; int[1] arr; arr[0] = 1; arr[length] = 2; }
With the above code, I get a runtime error
Error: ArrayBoundsError array.d(6)
which binds the string: arr [length] = 2.
Why does the constant 0 work, but the variable with the value 0 does not work?
source share