import "fmt"
func main() {
var sum = 0
for i := 1; i <= 10; i++ {
sum += i
}
fmt.Println(sum)
}
Outputs:
55
import "fmt"
func main() {
var sum = 0
for i := 1; i <= 10; i++ {
sum += i
}
fmt.Println(sum)
}
Outputs:
55
本文标题:Go for loop
本文链接:https://www.haomeiwen.com/subject/ijfwuqtx.html
网友评论