From d31422ceb078afe4fc088a2f012680d76a915fad Mon Sep 17 00:00:00 2001 From: Shikong <919411476@qq.com> Date: Tue, 14 Sep 2021 23:53:55 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20for...range=20=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/for/main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/base/for/main.go b/base/for/main.go index 1f5bc6b..331a411 100644 --- a/base/for/main.go +++ b/base/for/main.go @@ -40,4 +40,11 @@ func main() { break } } + + // for...range 循环 + s := "hello" + + for i, c := range s { + fmt.Printf("%d %c\n", i, c) + } }