changing method name for less confusion
This commit is contained in:
@@ -2,12 +2,12 @@ package go_koans
|
|||||||
|
|
||||||
type coolNumber int
|
type coolNumber int
|
||||||
|
|
||||||
func (cn coolNumber) double() int {
|
func (cn coolNumber) multiplyByTwo() int {
|
||||||
return int(cn) * 2
|
return int(cn) * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
func aboutTypes() {
|
func aboutTypes() {
|
||||||
i := coolNumber(4)
|
i := coolNumber(4)
|
||||||
assert(i == coolNumber(__int__)) // values can be converted between compatible types
|
assert(i == coolNumber(__int__)) // values can be converted between compatible types
|
||||||
assert(i.double() == __int__) // you can add methods on any type you define
|
assert(i.multiplyByTwo() == __int__) // you can add methods on any type you define
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user