mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 01:55:35 +08:00
update book code
This commit is contained in:
30
eBook/exercises/chapter_5/for_loop.go
Normal file → Executable file
30
eBook/exercises/chapter_5/for_loop.go
Normal file → Executable file
@@ -1,16 +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 }
|
||||
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