From d2c545bee3754ae4614fd7b160052747b19d870d Mon Sep 17 00:00:00 2001 From: Mihalis Tsoukalos Date: Thu, 13 Jun 2019 09:39:39 +0300 Subject: [PATCH] Added another cla --- ch14/outlier.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ch14/outlier.go b/ch14/outlier.go index 6377e4b..04e1c72 100644 --- a/ch14/outlier.go +++ b/ch14/outlier.go @@ -31,8 +31,8 @@ func meanValue(x []float64) float64 { func main() { flag.Parse() - if len(flag.Args()) == 0 { - fmt.Printf("usage: stats filename\n") + if len(flag.Args()) != 2 { + fmt.Printf("usage: stats filename limit\n") return } @@ -44,6 +44,12 @@ func main() { } defer f.Close() + limit, err := strconv.ParseFloat(flag.Args()[1], 64) + if err == nil { + fmt.Println(err) + return + } + data := make([]float64, 0) r := bufio.NewReader(f) for {