Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // controles switch2 switch.go
- package main
- import (
- "fmt"
- "time"
- )
- func main() {
- t := time.Now()
- switch { // switch true
- case t.Hour() < 12:
- fmt.Println("Bom dia!")
- case t.Hour() < 18:
- fmt.Println("Boa tarde!")
- default:
- fmt.Println("Boa noite!")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment