Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 233 Bytes

flush.md

File metadata and controls

19 lines (15 loc) · 233 Bytes
package main

import "fmt"

func main() {
	ch := make(chan int, 5)
	ch <- 1
	ch <- 2
	ch <- 3
	close(ch)

  // Always remember to flush the buffered channels after closing them.
	for len(ch) > 0 {
		fmt.Println(<-ch)
	}
}