Your IF function may not be necessary

Sometimes I run into conditions like the one below:


Apparently, the expression returns either true or false.

But the condition [A]=[B] can already be only true or false! Basically, it’s a tautology: IF true THEN true, IF false THEN false. Therefore the expression can be simplified and reduced to


The example can be generalized. Any expression that have the following pattern:

if(condition, true(), false())

Can be reduced to


And its result will be either true or false.

OK, but how about this? (notice true() and false() swapped)


Well, it’s effectively

if(not [A]=[B],true(), false())

Therefore it can be replaced with

not [A]=[B]

Or, if you wish, with

1 Like