3 ms·
here it is with Go: package main type km int func (distance km) launch_rocket() {} func main() { distance_miles := 42 // t
by svnpenn 4y ago
here it is with Go:
package main
type km int
func (distance km) launch_rocket() {}
func main() {
distance_miles := 42
// type int has no field or method launch_rocket
// distance_miles.launch_rocket()
// this works, but is obviously wrong:
km(distance_miles).launch_rocket()
}
- apgwoz 4y agoGo does pretty good with time. You could replicate that for distance, too.