go-tour/switch-with-no-condition.go
2020-02-04 21:44:36 -06:00

19 lines
276 B
Go

package main
import (
"fmt"
"time"
)
func main() {
t := time.Now()
switch {
case t.Hour() < 12:
fmt.Println("Good morning!")
case t.Hour() < 17:
fmt.Println("Good afternoon.")
default:
fmt.Println("Good evening.")
}
}