Go code
func say() { fmt.Println("Hello") }
go say()
time.Sleep(10 * time.Millisecond)Line-by-line explanation
- Say is defined.
- The go keyword starts it as a goroutine.
- Sleep keeps main alive briefly for this demonstration.
Expected output
HelloReal programs should coordinate completion rather than guessing with Sleep.