March 2020
Intermediate to advanced
406 pages
8h 39m
English
An implicit iterator gives the programmer an easy way to iterate through the elements that are stored within a container. This is often created with a built-in range in Go. The built-in range allows you to iterate through your container. The following is a code snippet implementing an implicit iterator:
package mainimport "fmt"func main() { stringExample := []string{"foo", "bar", "baz"} for i, out := range stringExample { fmt.Println(i, out) }}
We can see the resulting output as follows:

This output shows our iteration through the range of our stringExample variable. The range function is a very powerful construct that is ...
Read now
Unlock full access