From ee55ddcffd784015ef89bfd59a2d61967ffa17e0 Mon Sep 17 00:00:00 2001 From: Pierre Thibault Date: Wed, 31 Dec 2025 07:34:18 -0500 Subject: [PATCH] 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 --- doc/tut1.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/tut1.md b/doc/tut1.md index 3eaa1b1610..f116357394 100644 --- a/doc/tut1.md +++ b/doc/tut1.md @@ -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