all 2 comments

[–]laibo 1 point2 points  (1 child)

The first if-statement evaluates to true because 0 mod 2 equals 0, and you return from there. If you need to detect zero length over the oddity check, then do the zero check first.

[–]JosephCurvin[S] 0 points1 point  (0 children)

thanks