4 ms·
How is that different from func A() error { return compute.Something() }
by azth 14y ago
How is that different from
func A() error {
return compute.Something()
}
- zmj 14y agoThe example is easier to extend to include additional logic after the call or another return value.
- JulianMorrison 14y agoMy point is that whether it's "A() error" or "A() (int, error)", whether it calls one function or three, what it's doing with the error is throwing it up the line, rather than handling it locally. Exactly as if it had said "throw err". So yeah, your version is what I'd shorten it to in practise, it just wasn't quite so illustrative.