Documentation
¶
Overview ¶
Package tempconv performs Celsius and Fahrenheit temperature computations.
Example (One) ¶
{
fmt.Printf("%g\n", BoilingC-FreezingC) // "100" °C
boilingF := CToF(BoilingC)
fmt.Printf("%g\n", boilingF-CToF(FreezingC)) // "180" °F
}
/*
fmt.Printf("%g\n", boilingF-FreezingC) // compile error: type mismatch
*/
Output: 100 180
Example (Two) ¶
c := FToC(212.0)
fmt.Println(c.String()) // "100°C"
fmt.Printf("%v\n", c) // "100°C"; no need to call String explicitly
fmt.Printf("%s\n", c) // "100°C"
fmt.Println(c) // "100°C"
fmt.Printf("%g\n", c) // "100"; does not call String
fmt.Println(float64(c)) // "100"; does not call String
Output: 100°C 100°C 100°C 100°C 100 100
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fahrenheit ¶
type Fahrenheit float64
func CToF ¶
func CToF(c Celsius) Fahrenheit
func (Fahrenheit) String ¶
func (f Fahrenheit) String() string
Click to show internal directories.
Click to hide internal directories.