title: How to convert logical statements into their opposites?
body: <p>I have a scenario where I am checking whether to hide something depending on multiple variables values. For some these statements, if they evaluate to true, then I will skip over showing something (showing by default). However, I need to re-write my statements so that if they evaluate to true, then I will show something (hiding by default).</p>
  
  <p>For Example: </p>
  
  <pre><code>If X !== 1 &amp;&amp; Y !==1 
  </code></pre>
  
  <p>For Example: </p>
  
  <pre><code>If X === 3 or Y === 3 
  </code></pre>
  
  <p>If either example were true, then I would skip (hide) something.</p>
  
  <p>I need to flip conditions the conditions written in the code so that the expressions are their opposites. I cannot just evaluate the original expression and then swap the end true/false result.
  Would</p>
  
  <pre><code>X === 1 or Y === 1
  </code></pre>
  
  <p>And </p>
  
  <pre><code>X !== 3 &amp;&amp; Y !== 3
  </code></pre>
  
  <p>Be the logical opposites respectively? How can I approach re-writing these expressions so that they would evaluate to their opposite result every time? </p>
  
  <p>I cannot simply do !(If X !== 1 &amp;&amp; Y !==1) in this situation. Would De Morgan's law be applicable to what I am trying to do? I'm considering just flipping all "===" to "!===" (and vice versa) and flipping all "ands/ors" so that I can get the results I want. This seems to work in cases I've tried, however I am not sure whether it would be working in "all" cases. Thank you!</p>