Omitting Sections

Go’s for loop is flexible. You can omit the INITIAL and AFTER sections if they aren’t needed, keeping only the semicolons.

Syntax

i := 0
for ; i < 10; {
    fmt.Println(i)
    i++
}

Why omit?

This is useful when the loop counter is initialized elsewhere or when the increment logic is complex and needs to happen inside the loop body rather than in the AFTER block.

If you omit the CONDITION as well, you create a loop that runs forever (unless broken manually).