首页 > 代码库 > A Tour of Go For is Go's "while"

A Tour of Go For is Go's "while"

At that point you can drop the semicolons(分号): C‘s while is spelled for in Go.

package main import "fmt"func main() {    sum := 1    for sum < 1000 {        sum += sum    }    fmt.Println(sum)}

 

A Tour of Go For is Go's "while"