what would be the alternative? to always execute if the condition is true, but sometimes execute it even when false, for funsies?
In normal parlance, “if and only if” rules out that something could also happen as a result of other circumstances. EG, if you fall out of a plane, you will lose your glasses. But there are other conditions that would lead to the same result.
In code, the alternative would be to have a different if statement that executes identical code. Or *cough* you could use a jump instruction to execute literally the same code.
deleted by creator
Brb, making a truly “if” statement function in my products code base for funsies.
I hope this memer is not a programmer or logician, but ideally neither.
If and only if… haha unless…
An
ifstatement with one condition is an if and only if statement. The moment you add a second (or more) condition (regardless of&&or||), then it’s no longer if and only if.No, they’re not.
Let’s assume they are. Let funky function be defined as:
int funky() { a=0 b=1 if ( a==1 ) { b=1 } return(a) }Since a==1 if, and only if, b=1, in particular a==1 if b=1. We have b=1, therefore a==1. It follows funky will always return 1 but… it doesn’t. QED.
deleted by creator
I agree but it’s also what the original meme is doing. I thought we were all shitposting here.
deleted by creator
Don’t you just use iif?
Reminds me of this fun stack exchange q





