/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry Ecole du Logiciel Libre : https://e2li.org/ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see *******************************************************************/ package main import "fmt" func main() { for i := 0; i < 5; i++ { fmt.Println(i) } for i := 0; ; { if i >= 5 { break } fmt.Println(i) i++ } i := 0 for i < 5 { fmt.Println(i) i++ } i = 0 for ; ; i++ { if i >= 5 { break } fmt.Println(i) } for i := 0; i < 5; { fmt.Println(i) i++ } i = 0 for ; i < 5; i++ { fmt.Println(i) } for i := 0; ; i++ { if i >= 5 { break } fmt.Println(i) } i = 0 for { if i >= 5 { break } fmt.Println(i) i++ } for i, j := 0, 10; i != j; i, j = i+1, j-1 { fmt.Println(i, j) } }