From ddbecf50ffcbeffb71826ec2463d7d4bf9d98acb Mon Sep 17 00:00:00 2001 From: nannanwu Date: Fri, 7 Nov 2025 21:26:48 +0800 Subject: [PATCH] =?UTF-8?q?for=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/main.go b/main.go index 8fd72b5..22da86c 100644 --- a/main.go +++ b/main.go @@ -3,32 +3,10 @@ package main import "fmt" func main() { - score := 87 - switch score / 10 { - case 10: - fmt.Println("You are 10%") - case 9: - fmt.Println("You are 9%") - case 8: - fmt.Println("You are 8%") - //switch传透下一层 - fallthrough - case 7: - fmt.Println("You are 7%") - case 6: - fmt.Println("You are 6%") - case 5: - fmt.Println("You are 5%") - case 4: - fmt.Println("You are 4%") - case 3: - fmt.Println("You are 3%") - case 2: - fmt.Println("You are 2%") - case 1: - fmt.Println("You are 1%") - - default: - fmt.Println("You are 0%") + // for循环输出 + // 循环次数i1 < 10 + for i1 := 0; i1 < 10; i1++ { + fmt.Println("循环第", i1+1, "次") } + }