While loop in Golang
Unlike other programming languages like C, C++, Java, Python etc, Golang does not have while loop.
Instead, Golang’s for loop can be used as a while loop as well.
Let’s see a simple example:
package main
import "fmt"
func main() {
var count int
for count < 5 {
fmt.Println(count)
count += 1
}
}
The above program will print the following output:
0
1
2
3
4