Skip to content

Instantly share code, notes, and snippets.

@tilaklodha
Created September 24, 2017 23:11
Show Gist options
  • Save tilaklodha/0ebfff3357d24e094ea20cb53d31f657 to your computer and use it in GitHub Desktop.
Save tilaklodha/0ebfff3357d24e094ea20cb53d31f657 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"time"
)
func printnumbers() {
for i := 1; i <= 5; i++ {
time.Sleep(250 * time.Millisecond)
fmt.Printf("%d ", i)
}
}
func printletters() {
for i := 'a'; i <= 'e'; i++ {
time.Sleep(400 * time.Millisecond)
fmt.Printf("%c ", i)
}
}
func main() {
go printnumbers()
go printletters()
time.Sleep(5000 * time.Millisecond)
fmt.Println("Printing from main")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment