It may be a silly question, but I just wonder,
code:
func sumNumber(value int){
array1 := []int{3, 6, 7)
for _, v:= range array1{
go anotherFunction(v) // goroutine function is run three times
}
}
My question is, Which one will finish first, func sumNumber or goroutine anotherFunction?
This completely depends on so many factors,especially on what "anotherFunction" does. However the sumNumber function definitely is going to be very short lived as it is just going to initiate three go routines and exit.