Essential Go for, while loops  Suggest an edit

while loop

Go doesn’t have while loops because they can be written as for loops.

For example, this C++ while loop:

int n = 0;
while (n < 3) {
    printf("n: %d\n", n);
    n++;
}

can be written as for loop:

for n := 0; n < 3; n++ {
    fmt.Printf("n: %d\n", n)
}
  ↑ ↓ to navigate     ↵ to select     Esc to close