Create goroutines
suggest changeAny 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.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents