nil
value CRT-D0013If a return statement returns a value that evaluates to nil
, it is better to
return nil
explicitly.
Explicitly returning nil
improves the program's readability and helps
programmers know that they are returning nil
.
if err == nil {
return err
}
if err == nil {
return nil
}
if err != nil {
return err
}
// ...
return nil