这个是rectprops.go
// rectprops.go
package rectangle
import (
"fmt"
"math"
)
/*
* init function added
*/
func init() {
fmt.Println("rectangle package initialized")
}
func Area(len, wid float64) float64 {
area := len * wid
return area
}
func Diagonal(len, wid float64) float64 {
diagonal := math.Sqrt((len * len) + (wid * wid))
return diagonal
}
【 在 StephenLee 的大作中提到: 】
: 能放完整程序么,看起来 import 包并没有被调用
: - 来自「最水木 for iPhone13,2」
--
FROM 120.242.252.*