@@ -156,12 +156,12 @@ methodはstructの上でしか使用されないのでしょうか?当然違
156156 b.color = c
157157 }
158158
159- func (bl BoxList) BiggestColor () Color {
159+ func (bl BoxList) BiggestsColor () Color {
160160 v := 0.00
161161 k := Color(WHITE)
162162 for _, b := range bl {
163- if bv := b.Volume(); bv > v {
164- v = bv
163+ if b.Volume() > v {
164+ v = b.Volume()
165165 k = b.color
166166 }
167167 }
@@ -192,13 +192,13 @@ methodはstructの上でしか使用されないのでしょうか?当然違
192192 fmt.Printf("We have %d boxes in our set\n", len(boxes))
193193 fmt.Println("The volume of the first one is", boxes[0].Volume(), "cm³")
194194 fmt.Println("The color of the last one is",boxes[len(boxes)-1].color.String())
195- fmt.Println("The biggest one is", boxes.BiggestColor ().String())
195+ fmt.Println("The biggest one is", boxes.BiggestsColor ().String())
196196
197197 fmt.Println("Let's paint them all black")
198198 boxes.PaintItBlack()
199199 fmt.Println("The color of the second one is", boxes[1].color.String())
200200
201- fmt.Println("Obviously, now, the biggest one is", boxes.BiggestColor ().String())
201+ fmt.Println("Obviously, now, the biggest one is", boxes.BiggestsColor ().String())
202202 }
203203
204204上のコードはconstでいくつかの定数を定義しています。その後カスタム定義型を定義しています。
@@ -211,7 +211,7 @@ methodはstructの上でしか使用されないのでしょうか?当然違
211211
212212- Volume()はレシーバをBoxとして定義します。Boxの体積を返します。
213213- SetColor(c Color)はBoxの色をcに変更します。
214- - BiggestColor ()はBoxListに定義されており、listの中の体積が最大の色を返します。
214+ - BiggestsColor ()はBoxListに定義されており、listの中の体積が最大の色を返します。
215215- PaintItBlack()はBoxListのすべてのBoxの色を全部黒に変更します。
216216- String()はColorに定義されており、Colorの具体的な色を返します(文字列形式)
217217
0 commit comments