Sidechat icon
Join communities on Sidechat Download
Bc men dominate the computer science field... Explain to me like I'm 5 why this is wrong
17 upvotes, 20 comments. Sidechat image post by Anonymous in Ask Men. "Bc men dominate the computer science field... Explain to me like I'm 5 why this is wrong"
upvote 17 downvote

default user profile icon
Anonymous 1w

They’re coding for each possible option instead of making the code general and more concise

upvote 34 downvote
default user profile icon
Anonymous 1w

private bool IsEven(int number){ return not ((bool) (number & 1))

upvote 15 downvote
🥰
Anonymous 1w

Modular division exists. Less sarcastically you can divide by 2 for a remainder to check every possible even or odd case

upvote 15 downvote
default user profile icon
Anonymous 1w

I don’t even know this language but it seems pretty self explanatory. If a number “IsEven”, it will be true, otherwise it is false

upvote 12 downvote
default user profile icon
Anonymous 1w

You have to be baiting

upvote 9 downvote
default user profile icon
Anonymous 1w

The fact it’s Yan dev makes this even better, OP you might not know but dude is infamous for being dog water with code

upvote 8 downvote
default user profile icon
Anonymous 1w

Jus divide by 2 if the remainder is zero then true if not then false so it would be this symbol % when programming and you can use a condensed version of that

upvote 6 downvote
default user profile icon
Anonymous 1w

there’s plenty of atrocious things you could do in C, but whoever did that definitely did it as a joke

upvote 4 downvote
default user profile icon
Anonymous 1w

You could literally just use the modular operator to check if a number is even or odd and return an outcome based on that. Like in coding if you basically take a number and tell it to evaluate if the remainder of that number divided by 2 is 0 then that number is even

upvote 1 downvote
default user profile icon
Anonymous replying to -> #1 1w

Wdym??

upvote 6 downvote
default user profile icon
Anonymous replying to -> OP 1w

Like there's no way you actually don't get this

upvote 3 downvote
default user profile icon
Anonymous replying to -> #1 1w

Well geeeeeeez, thanks for being so kind! You typical CS major that believes they are so above everyone else!! Is it that hard to realize other ppl have no idea about coding AT ALL?!

upvote 1 downvote
default user profile icon
Anonymous replying to -> OP 1w

I'm not a CS major. Look I'll help you work out what's wrong, but the image provides enough context for anyone to reasonably get it, so I won't tell you outright. First of all, what is this code trying to find?

upvote 13 downvote
default user profile icon
Anonymous replying to -> #2 1w

And what does that even mean? So its wrong bc they are using true and false to count numbers instead of a number system?!

upvote 3 downvote
default user profile icon
Anonymous replying to -> OP 1w

Idk what you’re talking about. No it’s not wrong. This can easily be done in one line though, I’ll tell you that much.

upvote 9 downvote
default user profile icon
Anonymous replying to -> #3 1w

THANK YOU FOR BEING THE FIRST TO EXPLAIN THIS SIMPLY!!!

upvote 13 downvote
🌮
Anonymous replying to -> OP 1w

Yeah, they could just divide the number by 2 and check if the remainder is 1 or 0

upvote 24 downvote
user profile icon
Anonymous replying to -> OP 1w

Odd or even essentially

upvote 7 downvote
default user profile icon
Anonymous replying to -> #8 1w

I ain’t even notice who it was cuz I was staring at that disgusting piece of code

upvote 11 downvote
default user profile icon
Anonymous replying to -> #6 1w

you could even do #define IsEven(n) !(n&1)

upvote 3 downvote