Quick actions

cmd+k|ctrl+k

Navigation

Languages

Concurrency / Create goroutines / Essential Go

Snippet info

Language

Go

Visibility

public

Author

kkowalczyk

Created

2019-03-26T09:41:53Z

Updated

2019-03-26T09:41:53Z

package main

import (
	"fmt"
	"time"
)

func mult(x, y int) {
	fmt.Printf("%d * %d = %d\n", x, y, x*y)
}

func main() {
	go mult(1, 2) // first execution, non-blocking
	go mult(3, 4) // second execution, also non-blocking

	// that's not how you do it in real code
	time.Sleep(200 * time.Millisecond)
}
INFO