4 ms·
This doesn't work, but if it did you could simplify the switch statement to: switch v:= x.(type) { case int32, int64, float32, float64: if v <
by maxk42 12y ago
This doesn't work, but if it did you could simplify the switch statement to:
switch v:= x.(type) {
case int32, int64, float32, float64:
if v < 0 {
return -v
}
}
Go has some neat improvements to the switch statement: http://golang.org/doc/effective_go.html#switch http://golang.org/doc/effective_go.html#switch