diff --git a/ja/02.5.md b/ja/02.5.md index 41f2e3ea..5e44a746 100644 --- a/ja/02.5.md +++ b/ja/02.5.md @@ -156,12 +156,12 @@ methodはstructの上でしか使用されないのでしょうか?当然違 b.color = c } - func (bl BoxList) BiggestColor() Color { + func (bl BoxList) BiggestsColor() Color { v := 0.00 k := Color(WHITE) for _, b := range bl { - if bv := b.Volume(); bv > v { - v = bv + if b.Volume() > v { + v = b.Volume() k = b.color } } @@ -192,13 +192,13 @@ methodはstructの上でしか使用されないのでしょうか?当然違 fmt.Printf("We have %d boxes in our set\n", len(boxes)) fmt.Println("The volume of the first one is", boxes[0].Volume(), "cm³") fmt.Println("The color of the last one is",boxes[len(boxes)-1].color.String()) - fmt.Println("The biggest one is", boxes.BiggestColor().String()) + fmt.Println("The biggest one is", boxes.BiggestsColor().String()) fmt.Println("Let's paint them all black") boxes.PaintItBlack() fmt.Println("The color of the second one is", boxes[1].color.String()) - fmt.Println("Obviously, now, the biggest one is", boxes.BiggestColor().String()) + fmt.Println("Obviously, now, the biggest one is", boxes.BiggestsColor().String()) } 上のコードはconstでいくつかの定数を定義しています。その後カスタム定義型を定義しています。 @@ -211,7 +211,7 @@ methodはstructの上でしか使用されないのでしょうか?当然違 - Volume()はレシーバをBoxとして定義します。Boxの体積を返します。 - SetColor(c Color)はBoxの色をcに変更します。 -- BiggestColor()はBoxListに定義されており、listの中の体積が最大の色を返します。 +- BiggestsColor()はBoxListに定義されており、listの中の体積が最大の色を返します。 - PaintItBlack()はBoxListのすべてのBoxの色を全部黒に変更します。 - String()はColorに定義されており、Colorの具体的な色を返します(文字列形式)