infinite loop
- You don't have to put a condition in the for loop, but that will create an infinite loop.
- If you happen to run this on the command line, you can press Ctrl-C to stop this program.
- In this case you will need to use break or some other way to exit the loop.
examples/infinite-loop/infinte_loop.go
package main import ( "fmt" ) func main() { i := 0 for { fmt.Println(i) i++ } }
... 285583 285584 285585 285586 285587 285588 ^Csignal: interrupt