Go has only one looping construct: for
loop.
Here are basic forms.
Full form
https://codeeval.dev/gist/9870092f584e2a8b22975b537b4b8884
Every part of loop statement is optional.
Without initialization statement
https://codeeval.dev/gist/4378f43b1d016fa3a85f9786c6476f84
Without test expression
Using break
to terminate the loop
https://codeeval.dev/gist/b9fc06c6cd529c4141c349af0580b733
Without increment statement
https://codeeval.dev/gist/7e8af34a77b303fe7e1e046cdef6995b
Infinite loop
https://codeeval.dev/gist/1206d992a950885e9ba867de8e222a68
for
loop over a slice with range