Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    func fn(c color.Color) {
     switch c {
     case color.Red, color.Green, color.Blue:
      log.Printf("c=%#+v -- OK", c)
     default:
      log.Printf("c=%#+v -- should not be possible", c)
     }
    }
    
    func main() {
     var c color.Color
     fn(c)
    }    
Output:

    c=<nil> -- should not be possible
:shrug:


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: