shad-go/lectures/01-basics/tempconv/tempconv.go

14 lines
264 B
Go
Raw Permalink Normal View History

2020-02-20 14:40:51 +00:00
package tempconv
import "fmt"
type Celsius float64
type Fahrenheit float64
const (
AbsoluteZeroC Celsius = -273.15
)
func (c Celsius) String() string { return fmt.Sprintf("%g°C", c) }
func (f Fahrenheit) String() string { return fmt.Sprintf("%g°F", f) }