Go doesn’t have while
loops because they can be written as for
loops.
For example, this C++ while loop:
#include <stdio.h>
int main(void) {
// :show start
int n = 0;
while (n < 3) {
printf("n: %d\\n", n);
n++;
}
// :show end
}
can be written as for
loop:
https://codeeval.dev/gist/9c87783784ce13d71702eb40f71c5d62
A more concise version: