Negate a condition if a bool is FALSE Let's say I have a condition expression x and that I want to check if it is TRUE or FALSE depending on the value of a boolean y:

y ? x : !x


Is there a way to express it without repeating x expression? Something like how we can get a number or its opposite depending on a bool, without repeating the number in the expression:

number * (opposite ? -1 : 1)


Example, note the repetition of date.hour &lt; 12 that I want to avoid:

tellTheThruth = FALSE; // or TRUE 
if (tellTheThruth &amp;&amp; date.hour &lt; 12 || !tellTheThruth &amp;&amp; !(date.hour &lt; 12) {
    print "It's AM"
} else {
    print "It's PM" 
} 


Is it possible in all common languages (I was thinking in Javascript and I can't find a solution)? If not, is there some language in which you can?
for two booleans x and y, y ? x : !x can be rewritten as y ^ !x (y XOR NOT x) or similar in most languages.