From: Robert Griesemer Date: Wed, 24 Apr 2024 00:30:02 +0000 (-0700) Subject: spec: clarify when a range expression is evaluated X-Git-Tag: go1.23rc1~529 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=db5f2b415399da9b653e68aa03f23ce661cc5339;p=gostls13.git spec: clarify when a range expression is evaluated If the range expression is a numeric constant, the range expression is also not evaluated. Change-Id: I97201e5c136d3d1a87ed1500b19b7199b30bc9ff Reviewed-on: https://go-review.googlesource.com/c/go/+/581298 Reviewed-by: Robert Griesemer Reviewed-by: Ian Lance Taylor TryBot-Bypass: Robert Griesemer Auto-Submit: Robert Griesemer --- diff --git a/doc/go_spec.html b/doc/go_spec.html index 0fd12bf4b5..f5069f62d6 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -6644,8 +6644,8 @@ the range clause is equivalent to the same clause without that identifier.

The range expression x is evaluated once before beginning the loop, -with one exception: if at most one iteration variable is present and -len(x) is constant, +with one exception: if at most one iteration variable is present and x or +len(x) is constant, the range expression is not evaluated.