9 Answered Questions for the topic Boolean

07/13/19

How do I determine if *exactly* one boolean is true, without type conversion?

Given an arbitrary list of booleans, what is the most elegant way of determining that *exactly* one of them is true? The most obvious hack is type conversion: converting them to `0` for `false`... more

07/06/19

XOR of three values?

What is the simplest way to do a three-way exclusive OR? In other words, I have three values, and I want a statement that evaluates to true IFF only *one* of the three values is true. So far,... more

06/27/19

What is the Objective-C way of getting a nullable bool?

How should I go about getting a bool value that I can assign true, false and nil to in Objective-C? What is the Objective-C way of doing this? Much like C#'s Nullable<bool>. I'm looking to... more

06/22/19

Check severeal boolean returns in same time?

I have several bool elements and I am checking it if returns me false. bool i = false; switch (idcount) { case 1: i = p1(); break; case 2: i = p1() & p2(); break; case 3: i = p1() &... more

06/22/19

Check severeal boolean returns in same time?

I have several bool elements and I am checking it if returns me false. bool i = false; switch (idcount) { case 1: i = p1(); break; case 2: i = p1() & p2(); break; case 3: i = p1() &... more

05/29/19

How to parse a string of boolean logic in PHP?

I'm building a PHP class with a private member function that returns a string value such as: 'true && true || false' to a public member function. (This string is the result of some regex... more

05/20/19

What does Exclusive in XOR really mean?

Maybe this is just obvious to everyone but can someone explain where XOR (or Exclusive-OR) got its name from? What does the word ***Exclusive*** really mean? Not that it matters, but its just stuck... more

04/14/19

In Java, what are the boolean "order of operations"?

Let's take a simple example of an object `Cat`. I want to be sure the "not null" `cat` is either orange or grey. if(cat != null && cat.getColor() == "orange" || cat.getColor() == "grey")... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.