package main

import "fmt"

func main() {
	// empty

}

// section: range
func rangeLoop(messages chan string) {
	// loop until the channel is closed
	for m := range messages {
		fmt.Println(m)
	}
}

// section: range

// section: for
func forLoop(messages chan string) {
	// loop until the channel is closed
	for {
		m, ok := <-messages
		if !ok {
			// channel was closed
			break
		}
		fmt.Println(m)
	}
}

// section: for
