Hacker News new | ask | show | jobs
by maxk42 4434 days 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