package main

import "fmt"

// section: code
func main() {
	quit := make(chan struct{})
	go count(5, quit)
	<-quit
}

func count(i int, quit chan struct{}) {
	defer close(quit)
	for j := 0; j < i; j++ {
		fmt.Println("processing...", j)
	}
}

// section: code

/*
// section: output
$ go run ./main.go
processing... 0
processing... 1
processing... 2
processing... 3
processing... 4
// section: output
*/
