未验证 提交 2bca9b87 编写于 作者: A astaxie 提交者: GitHub

Merge pull request #1093 from rikoroku/fix-ja/02.5.md

fix error that [undefined: by] in 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の具体的な色を返します(文字列形式)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册