should use 'return len(s) == 0' instead of 'if len(s) == 0 { return true }; return false'
67}
68
69func empty(s string) bool {
70 if len(s) == 0 {71 return true
72 }
73 return false
Description
Instead of conditionally checking for the value of a boolean expression and then
returning true
or false
, returning the expression itself simplifies the code
and improves readability.
Bad practice
if max > min {
return true
}
return false
Recommended
return max > min