The number of elements in a collection, an array or a string are always greater than or equal to zero. So testing that a size or length is greater
than or equal to zero doesn’t make sense, since the result is always true
. Similarly testing that it is less than zero will always return
false
. Perhaps the intent was to check the non-emptiness instead.
Noncompliant Code Example
if (myArray.count >= 0) { ... }
if (myString.characters.count < 0) { ... }
Compliant Solution
if (myArray.isEmpty) { ... }
if (myString.isEmpty) { ... }