The initialization and modification part of the for loop structure is optional.
Similar to the following
for ; condition; {
...
}
The two semicolons can also be omitted.
The following is a complete code example.
package main
import "fmt"
func main() {
sum := 1
for ; sum < 1000; {
sum += sum
}
fmt.Println(sum)
for sum < 2000 {
sum += sum
}
fmt.Println(sum)
}
Below is the program output:
1024
2048