Table of Contents

About

The for loop is the only loop statement in Go.

It has a number of forms

for initialization; condition; post { 
    // zero or more statements 
}
  • a traditional “while” loop
for condition { 
    // ... 
} 
  • a traditional infinite loop
for { 
    // ... 
}