From 34b69520f3d3748efad2fc02b2461158eb664735 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Tue, 16 Jan 2024 10:21:57 -0500 Subject: [PATCH] added fuel for chapter nine --- playground/fuel.go | 16 ++++++++++++++++ playground/playground.go | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 playground/fuel.go diff --git a/playground/fuel.go b/playground/fuel.go new file mode 100644 index 0000000..b2d7840 --- /dev/null +++ b/playground/fuel.go @@ -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) +} diff --git a/playground/playground.go b/playground/playground.go index 81952b4..e265b89 100644 --- a/playground/playground.go +++ b/playground/playground.go @@ -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 {