package main

import "fmt"

// section: types
// Type definition - creates a NEW distinct type
type Celsius float64

// Type alias - just another name for the same type
type Fahrenheit = float64

// section: types

func main() {
	// section: main
	var c Celsius = 100.0
	var f Fahrenheit = 212.0

	// This works - Fahrenheit is just an alias for float64
	var temp float64 = f
	fmt.Printf("temp from alias: %v\n", temp)

	// This DOESN'T work - Celsius is a different type
	// temp = c  // compiler error: cannot use c (type Celsius) as type float64

	// Need explicit conversion for type definitions
	temp = float64(c)
	fmt.Printf("temp from conversion: %v\n", temp)
	// section: main
}

/*
// section: output
$ go run main.go
temp from alias: 212
temp from conversion: 100
// section: output
*/
