learning_go/mytypes/mytypes.go
2025-06-30 06:58:29 +03:00

35 lines
468 B
Go

package mytypes
import "strings"
type MyInt int
type MyString string
type MyBuilder struct {
Contents strings.Builder
}
func (i MyInt) Twice() MyInt {
return i * 2
}
func (i MyString) Len() int {
return len(i)
}
func (s MyBuilder) Hello() string {
return "Hello, Gophers!"
}
func (s MyBuilder) Uppers(in string) string {
return strings.ToUpper(in)
}
func Double(input *int) int{
*input *= 2
return *input
}
func (input *MyInt) Double() {
*input *= 2
}