mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 01:55:35 +08:00
05.0.md
This commit is contained in:
16
eBook/exercises/chapter_5/for_loop.go
Normal file
16
eBook/exercises/chapter_5/for_loop.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
// 1:
|
||||
for i:=0; i < 15; i++ {
|
||||
fmt.Printf("The counter is at %d\n", i)
|
||||
}
|
||||
// 2:
|
||||
i := 0
|
||||
START:
|
||||
fmt.Printf("The counter is at %d\n", i)
|
||||
i++
|
||||
if i < 15 { goto START }
|
||||
}
|
Reference in New Issue
Block a user