added fuel for chapter nine
This commit is contained in:
		
							
								
								
									
										16
									
								
								playground/fuel.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								playground/fuel.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
// part of chapter 9
 | 
			
		||||
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import "fmt"
 | 
			
		||||
 | 
			
		||||
type Liters float64
 | 
			
		||||
type Gallons float64
 | 
			
		||||
 | 
			
		||||
func fuel() {
 | 
			
		||||
	var carFuel Gallons
 | 
			
		||||
	var busFuel Liters
 | 
			
		||||
	carFuel = Gallons(10.0)
 | 
			
		||||
	busFuel = Liters(240.0)
 | 
			
		||||
	fmt.Println(carFuel, busFuel)
 | 
			
		||||
}
 | 
			
		||||
@@ -104,6 +104,12 @@ func main() {
 | 
			
		||||
				magazineSubscribers()
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: "Fuel",
 | 
			
		||||
			launchFunction: func() {
 | 
			
		||||
				fuel()
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	menu := wmenu.NewMenu("Choose a program.")
 | 
			
		||||
	menu.Action(func(opts []wmenu.Opt) error {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user