News for hackers. Stuff that matters.
Re:The Go Programming Language, or: Why all C-like languages... by zvrba on Wednesday June 08, 2011 @11:31AM (#2633519)
"switch true {...}" or "switch {...}"? really? So how would

  switch 3.141592654 { ... }
affect the case-statements inside?
Re:The Go Programming Language, or: Why all C-like languages... by supersillyus on Wednesday June 08, 2011 @01:57PM (#2634216)
When you say "switch <value>", it matches the "case" statements based on if the value after "case" is equal to <value>. So, if you say

    const P = 3.141
    switch 3.141 {
       case P: 
          fmt.Println("This prints") 
    }
When no value is specified after "switch", the value of "true" is implied, which is why you can do:

    switch {
       case a && b: ..
       case something():
    }
Re:The Go Programming Language, or: Why all C-like languages... by chrisjsmith on Wednesday June 08, 2011 @11:37AM (#2633556)
No idea as I wouldn't do it :) (sorry - cop out that)