Skip to content

Instantly share code, notes, and snippets.

View wqhyw's full-sized avatar
🎯
Focusing

LeO_wqHyw wqhyw

🎯
Focusing
  • kuaishou.com
  • Beijng, China
View GitHub Profile
@wqhyw
wqhyw / main.go
Created June 13, 2023 13:30
Print odd and even numbers alternately with two goroutines.
package main
func main() {
odd := make(chan int)
even := make(chan int)
// sub-routine print even number
go func() {
for i := <-even; i <= 10; i = <-even {
println("sub : ", i)