Missleading sentence about array indexing (#25367)

I added some precision. The first time I read this sentence, I was
confused. This applies to the above example, but it cannot be
generalized, since every array has its own range of valid indexes.

I think this change make the documentation clearer.

---------

Co-authored-by: Andreas Rumpf <araq4k@proton.me>
This commit is contained in:
Pierre Thibault
2025-12-31 07:34:18 -05:00
committed by GitHub
parent 61970be479
commit ee55ddcffd

View File

@@ -1278,9 +1278,10 @@ Arrays can be constructed using `[]`:
echo x[i]
```
The notation `x[i]` is used to access the i-th element of `x`.
Array access is always bounds checked (at compile-time or at runtime). These
checks can be disabled via pragmas or invoking the compiler with the
The notation `x[i]` is used to access the i-th element of `x` in the example
above. Valid indexes can be defined by any subrange. Array access is
always bounds checked (at compile-time or at runtime). These checks can be
disabled via pragmas or invoking the compiler with the
``--bound_checks:off`` command line switch.
Arrays are value types, like any other Nim type. The assignment operator