代码点读机 / Go / math.Pi

math.Pi Go · 包功能

圆周率 π 的常量近似值。

怎么用

math.Pi

小例子

package main
import (
    "fmt"
    "math"
)

func main() {
    fmt.Println(math.Pi)
}

运行结果

输出 3.141592653589793

提醒:注意是大写 P,Go 导出标识符首字母必须大写

官方文档:https://pkg.go.dev/math#Pi

在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← Go全部词条