标签:print fun class pre main style UNC for循环 div
有限循环
func main() { for i := 2; i <= 10; i += 2 { //i := 2 起始条件 i<=1= 结束条件 i+=2 循环条件 fmt.Println("好好学习", i) } }
func main() { var count= 0 for { if count%2 == 0 { fmt.Println("好好学习",count) } else { fmt.Println("今天撩妹",count) } count++ time.Sleep(500*time.Microsecond) if count >= 11 { break //跳出循环 } } }
func main() {
var count = 0
for {
if count%5 == 0 {
// 继续下次循环
continue
}
count++
fmt.Println("好好学习", count)
if count >= 21 {
break
}
}
}
标签:print fun class pre main style UNC for循环 div
原文地址:https://www.cnblogs.com/paad/p/10999369.html