github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2014/readability/if-switch-good.go (about)

     1  // +build OMIT
     2  
     3  package sample // OMIT
     4  
     5  func BrowserHeightBucket(s *session.Event) string {
     6  	size := sizeFromSession(s)
     7  	h := size.GetHeight()
     8  	switch {
     9  	case h <= 0: // HL
    10  		return "null"
    11  	case h <= 480: // HL
    12  		return "small"
    13  	case h <= 640: // HL
    14  		return "medium"
    15  	default: // HL
    16  		return "large"
    17  	}
    18  }