Section6.50
This commit is contained in:
37
Section6/main.go
Normal file
37
Section6/main.go
Normal 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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user