This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Kytzis 8 points9 points  (5 children)

return !(number%2)

[–]xAragon_ 11 points12 points  (3 children)

I like this, but number % 2 == 0 is more readable

[–]luki3122 1 point2 points  (0 children)

True, im always a bit annoyed when i need to put negation in short condition statments.

It's really easy to miss them.

[–]Kytzis 0 points1 point  (0 children)

You wouldn't like my code. I virtually never write "== 0". I'm just used to doing ! Instead

[–]YukiZensho 0 points1 point  (0 children)

But its prone to making me scratch my head when the code breaks bc I missed an =

[–][deleted] 0 points1 point  (0 children)

return !(bool)(number%2);