mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 21:43:33 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user