跳到主要内容
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.