From 39c8d853a5802eb74eacf59d111b3f5914bcd84c Mon Sep 17 00:00:00 2001 From: sebastian Date: Wed, 4 Oct 2023 11:00:52 +0200 Subject: [PATCH] Section6.50 --- Section6/main.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Section6/main.go diff --git a/Section6/main.go b/Section6/main.go new file mode 100644 index 0000000..c6c315b --- /dev/null +++ b/Section6/main.go @@ -0,0 +1,37 @@ +package main + +import "fmt" + +func main() { + price, inStock := 100, true + + if price > 80 { + fmt.Println("Too Expensive!") + } + + // _ = inStock + + if price <= 100 && inStock == true { + fmt.Println("Buy it!") + } + + if price < 100 { + fmt.Println("It is cheap") + } else if price == 100 { + fmt.Println("hmmm...") + } else { + fmt.Println("Expensive!") + } + + age := 17 + + if age >= 0 && age < 18 { + fmt.Printf("You can not vote. Please return in %d years. \n", 18-age) + } else if age == 18 { + fmt.Printf("This is your first vote") + } else if age > 18 && age <= 100 { + fmt.Printf("Please vote") + } else { + fmt.Printf("Invalid age") + } +}