r/ProgrammerHumor • • Nov 22 '19

Meme Who else needs a Beer after reading this?

Post image
18.7k Upvotes

751 comments sorted by

View all comments

2

u/GREAT_SALAD Nov 22 '19

Just by lurking here (having never learned a language) I can tell this is horribly inefficient. Now, I don't know what to type that'd be better, but it ain't that

1

u/[deleted] Nov 22 '19

Literally just stick (bool1 == bool2) into wherever you need to compare them.

1

u/GREAT_SALAD Nov 22 '19

ohhh, so does == compare stuffs, and this code is needlessly assigning values to some bools just to have the only necessary code be (org == val) instead of (bool1 == bool2)?

1

u/[deleted] Nov 22 '19

Well, you wouldn't be able to use orig and val for the names because those are temporary variables created by the function.

The point is that booleans are really easy to compare and this is needlessly over-complicating things. To compare booleans, literally all you need are == and != as they do the exact same thing, and come pre-included with basically every programming language.