Essential Go Concurrency  Suggest an edit

Create goroutines

Any function can be invoked as a goroutine by prefixing its invocation with the keyword go:

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

go mult(1, 2) // first execution, non-blocking
go mult(3, 4) // second execution, also non-blocking
1 * 2 = 2
3 * 4 = 12

Note that the return value of the function is ignored.

  ↑ ↓ to navigate     ↵ to select     Esc to close