3 ms·
Here's a search of the go source for use of that: https://github.com/golang/go/search?p=3&q=%22for+range%22&type=Code&utf8=%E2%9C%93 https://github.com/golang/g
by Laremere 12y ago
Here's a search of the go source for use of that: https://github.com/golang/go/search?p=3&q=%22for+range%22&type=Code&utf8=%E2%9C%93 https://github.com/golang/go/search?p=3&q=%22for+range%22&ty...
Most of them are tests, but I see a couple genuine use cases:
1. Draining a channel until it closes.
2. Since range of a string gives utf8 runes, the RuneCountInString function in the utf8 package simply has an integer count, and does a range through the string increasing the count in every loop.