Create goroutines

suggest change

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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents