Skip to content

Instantly share code, notes, and snippets.

@doron2402
Created April 7, 2020 07:51

Revisions

  1. doron2402 created this gist Apr 7, 2020.
    20 changes: 20 additions & 0 deletions ex_channel.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    package main

    import (
    "fmt"
    "time"
    )

    func say(str string) {
    time.Sleep(1 * time.Millisecond)
    for i := 0; i < 10; i++ {
    fmt.Printf("%d) %v\n", i, str)
    }
    }

    func main() {
    go say("Hello")
    go say("World")
    go say("Bye")
    time.Sleep(100 * time.Millisecond)
    }