Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • You're described the truth table for a logic function of two variables, but this is a logic function of only one variable.... (The first row in your table should not exist) Commented Nov 17 at 19:19
  • 1
    Context is important. There are two values being tested by the OP, either of which may be true or false, and then combined with OR when it should be AND. For the purpose of that particular truth table and that particular if [[ ... ]] test, it doesn't matter in the slightest that they are potential values for just one variable. However, that is why i recommended simplifying it to just a single regex test with alternation, no need for AND or OR. Commented Nov 18 at 0:41
  • For that particular if test, it absolutely matters that both branches test the same variable. It makes "Not cli" false, "Not Gui" false impossible. Commented Nov 18 at 0:47
  • 3
    As far as that particular table is concerned, it doesn't matter at all that that situation is impossible. The OP's if statement was testing for both conditions, and using OR instead of AND was distorting the result they wanted - that was the point of my answer, and the table only exists to illustrate WHY using OR in that particular test could not produce an accurate or useful result. Commented Nov 18 at 1:06
  • At any rate, learning boolean logic tables is basic stuff for developers, and should always be encouraged. A complete answer is always preferred. Commented 9 hours ago