package main
import (
"fmt"
"time"
)
func download(ch chan string) {
time.Sleep(1 * time.Second)
ch <- "Download complete!"
}
func main() {
ch := make(chan string)
go download(ch)
fmt.Println("Downloading...")
fmt.Println(<-ch) // blocks until channel has data
fmt.Println("End of main()")
}
To embed this project on your website, copy the following code and paste it into your website's HTML: