12. Combining Boolean Operators


#1



Hi coders!

I am a bit confused about the following lesson:


12. Combining Boolean Operators


my reasoning is:
(3 < 4 || false) is false
(false || true) false
hence the whole expression to me is false?

however the lesson consider it as true. Please can you help?

Thanks!

boolean_1 = (3 < 4 || false) && (false || true)


#2

is not false
first, let's look at both sides
it's ultimately
true || false
the reason that this is considered true, is because ||, the boolean operator or, is evaluating whether AT LEAST one side is true.
so true or false amounts to true, because there is one true in there.
true || true would be true, because there's at least one true.
false || false would be false, because there is no true.

Does this help at all?


#3

This is very helpful @kyleaw . will go through the II theory again! Thanks!


#4

No problem! You'll understand it more as you go along. There are some really good resources if you look at documentation and other similar help.
It's important stuff that you'll need to know... Not really for problems like this, but things that amount to it.
have fun!


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.