14 lines
310 B
Go
14 lines
310 B
Go
package go_koans
|
|
|
|
type coolNumber int
|
|
|
|
func (cn coolNumber) double() int {
|
|
return int(cn) * 2
|
|
}
|
|
|
|
func aboutTypes() {
|
|
i := coolNumber(4)
|
|
assert(i == coolNumber(__int__)) // values can be converted between compatible types
|
|
assert(i.double() == __int__) // you can add methods on any type you define
|
|
}
|