Return potential error
(x float64, y float64)
| 46 | |
| 47 | // Return potential error |
| 48 | func getQuotient(x float64, y float64) (ans float64, err error) { |
| 49 | if y == 0 { |
| 50 | // Define error message returned with dummy value |
| 51 | // for ans |
| 52 | return 0, fmt.Errorf("You can't divide by zero") |
| 53 | } else { |
| 54 | // If no error return nil |
| 55 | return x / y, nil |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | // Variadic function |
| 60 | func getSum2(nums ...int) int { |