github.com/brownsys/tracing-framework-go@v0.0.0-20161210174012-0542a62412fe/go/darwin_amd64/misc/tour/content/flowcontrol/switch-evaluation-order.go (about)

     1  // +build OMIT
     2  
     3  package main
     4  
     5  import (
     6  	"fmt"
     7  	"time"
     8  )
     9  
    10  func main() {
    11  	fmt.Println("When's Saturday?")
    12  	today := time.Now().Weekday()
    13  	switch time.Saturday {
    14  	case today + 0:
    15  		fmt.Println("Today.")
    16  	case today + 1:
    17  		fmt.Println("Tomorrow.")
    18  	case today + 2:
    19  		fmt.Println("In two days.")
    20  	default:
    21  		fmt.Println("Too far away.")
    22  	}
    23  }