How does Go calculate the sum of numbers
This article mainly introduces the relevant knowledge of "how Go calculates the sum of numbers". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to calculate the sum of numbers in Go" can help you solve the problem.
The following example calculates the sum of numbers through two goroutine, and after goroutine completes the calculation, it calculates the sum of the two results:
Example
Package main
Import "fmt"
Func sum (s [] int, c chan int) {
Sum: = 0
For _, v: = range s {
Sum + = v
}
C