Skip to content

Conversation

@lvjp
Copy link

@lvjp lvjp commented Oct 4, 2025

Since go1.22 language changes have made looping easy.

We can now loop over integer:

-for i := 0; i < 10; i++ {
+for i := range 10 {

And there is no more need to redeclare loop variable:

 for i := 0; i < 10; i++ {
-    i := i

(no more understanding problems like #67)

lvjp added 3 commits October 4, 2025 12:17
This permits the main and fork repository to verify that everything is fine
before opening a pull request.
With the go1.22 language change, we do not need anymore to redeclare a new
variable inside the loop to prevent overwride.

Golang changelog: https://go.dev/doc/go1.22#language

Close: gammazero#67 What is the purpose of "r := r"?
We can now write: `for i := range 10`

Golang changelog: https://go.dev/doc/go1.22#language
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant