Correct me if I'm wrong, there are only 3 types of loops in Go.
Type1 (The most basic type, with a single condition):
for i <= 3 {...}
Type2 (Classical for-loop)
for j := 7; j <= 9; j++ {...}
Type3 (infinite loop rely on break)
for {...break}
Then I come across this for loop that sums the value from array
nums := []int{2, 3, 4}
sum := 0
for _, num := range nums {
sum += num
}
fmt.Println("sum:", sum)//"sum: 9"
Is the above for-loop
to be considered Type1 where it automatically applies <=
and range of nums as max value? Can I in any way change the value? maybe I need two extra loops? Can we apply something like range + 2
?