Section6.54

This commit is contained in:
2023-10-04 14:55:12 +02:00
parent 39c8d853a5
commit 4e13ad8a10
3 changed files with 54 additions and 0 deletions

37
Section6/50.go Normal file
View File

@@ -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")
}
}