go-imgrow/dividebyzero.go

13 lines
151 B
Go
Raw Normal View History

2024-02-09 19:10:01 +00:00
package imgrow
func divideByZero(n int) int {
switch {
case 0 < n:
return intMax
case n < 0:
return intMin
default: // 0 == n
return 0
}
}