stickers was made by Takuya Ueda. Licensed under the Creative Commons 3.0 Attributions license. まずはイテレータ (range over func)の 仕様を学ぼう 2024/09/24 Goのイテレータ深堀りNight https://tenn.in/iternight 1
func() bool) {} for range seq0 {} seq1 := func(yield func(X) bool) {} for x := range seq1 {} seq2 := func(yield func(X, Y) bool) {} for x, y := range seq2 {} for range文に関数が指定できるようになった
c <= 'Z'; c++ { // 'A', 'B', 'C', … if !yield(c) { return } } } func usage() { // ABC for c := range Alphabet { fmt.Printf("%c", c) if c == 'C' { break } } }