check the code below , there are 3 cases
There is error in the case int, int8 ,int16 ....   line
why is that

func LimRange(x, low, high interface{}) float64 {
   var fx, flow, fhigh float64
   switch v := x.(type) {
   case int:                   //OK
   case int8:
   case int16:
   case int32:
      
      return float64(v)

   default:
      return math.NaN()
   }

   switch v := x.(type) {
   case int,int8,int16,int32:  //Error: cannot convert v (type interface {}) to 
type float64: need type assertion
      return float64(v)
   default:
      return math.NaN()
   }

    a :=1
   switch a {
   case 1,2:                    //OK
      println("1,2")
   }

   return math.Max(math.Min(fx, fhigh), flow)
}

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to