Перейти к основному содержимому
0

Этот урок пока на английском.

Loop over anything

range already works on slices, maps, channels and numbers. Since Go 1.23 it also works on functions, so your own code can hand out values one at a time, just like the built-in types. A function used this way is called an iterator.