Mushi

switch2.go

Apr 25th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.28 KB | None | 0 0
  1. // controles switch2 switch.go
  2. package main
  3.  
  4. import (
  5.     "fmt"
  6.     "time"
  7. )
  8.  
  9. func main() {
  10.     t := time.Now()
  11.     switch { // switch true
  12.     case t.Hour() < 12:
  13.         fmt.Println("Bom dia!")
  14.     case t.Hour() < 18:
  15.         fmt.Println("Boa tarde!")
  16.     default:
  17.         fmt.Println("Boa noite!")
  18.     }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment