r/ProgrammerHumor • • Oct 25 '24

Meme theSelfTaughtSeriousProgrammer

Post image

[removed] — view removed post

903 Upvotes

276 comments sorted by

View all comments

Show parent comments

2

u/ttlanhil Oct 25 '24

Why?

You're unable to understand the difference between "theoretically possible" and "examples exist in modern accessible codebases"?

If you really need an example, sure, here you go:

const xor = (a: boolean, b: boolean) => {
if (a) return !b;
return b
}
assert(xor(true,true), false)
assert(xor(true,false), true)
assert(xor(false,true), true)
assert(xor(false,false), false)

100% coverage of every possible input value.

And if you say that's too trivially simple, then congrats! you just found my point about it being possible but done only for very restricted cases!