https://play.golang.org/p/l6pbuFDz_eP
I’m not sure how to ask these questions, but I’ll give it a shot.
The above code yields
[2 3 4 5 6 7 8 9]
[]int
for item in index position 0 we are now adding 2 to the total which is now 2
for item in index position 1 we are now adding 3 to the total which is now 5
for item in index position 2 we are now adding 4 to the total which is now 9
for item in index position 3 we are now adding 5 to the total which is now 14
for item in index position 4 we are now adding 6 to the total which is now 20
for item in index position 5 we are now adding 7 to the total which is now 27
for item in index position 6 we are now adding 8 to the total which is now 35
for item in index position 7 we are now adding 9 to the total which is now 44
The total is 44
The total is 44
Which part of this is executed (correct word?) by
fmt.Println(“The total is”, x)
That’s my first question.
Also, which part of this is executed (correct word?) by
fmt.Println(“The total is”, sum)
return sum