You're viewing a single thread.
All Comments
183 comments
Cosmicomical @lemmy.world There is a simpler way: all the "else if"s can be replaced with simple "if"s
7 0 ReplyValmond @lemmy.mindoki.com You mean make it even worse.(performance wise)? Interesting.
1 3 Replymryessir @lemmy.sdf.org Please elaborate. When and why would his suggestion be worse?
4 0 Replymellejwz @lemmy.world It will check all of the if statements instead of stopping at the first match.
1 2 Replymryessir @lemmy.sdf.org Each clause already returns
7 0 Replymellejwz @lemmy.world My bad, I looked over the returns. If you return something there wouldn't be much difference between both.
2 0 ReplyCosmicomical @lemmy.world Ok just to clarify this was a joke. It was just a pedantic improvement on a deranged solution. The only sensible way to do this is with % 2 or with bitwise operations imo.
1 0 Reply
Valmond @lemmy.mindoki.com Yeah gotta store the return value in a variable!
1 0 Reply
183 comments
Scroll to top