The release notes https://go.dev/doc/go1.22 refer to the spec here

https://go.dev/ref/spec#For_range

but I do not see any details about the new for i := range 10 statement 
there.

This is strange. Have the docs simply not been updated yet?

But I do see this oddly out of place statement, where I'm not sure at all 
what x is referring to in the earlier paragraphs.

"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 <https://go.dev/ref/spec#Length_and_capacity>, the range 
expression is not evaluated."

This would seem to say that, if x is the integer 10, as in the above 
example, and if the len(10) is somehow defined (not sure it would be, but a 
new reader might reasonably assume that an integer has constant length), 
that the range expression would not be evaluated... which seems very odd. 
I'm not sure what this sentence is talking about at all really.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/01c51ea7-e09e-4e69-95eb-456981086764n%40googlegroups.com.

Reply via email to