<In what way does your code behave incorrectly? Include ALL error messages.>
I don’t understand how the line prints out false. I got it correct, but after working it out individually in my head I get true. Unless I’m doing the order wrong. Someone explain please.

( 1 < 8 && ( 5 > 2 || 3 < 5))
| AND | OR |
v v v
true true true

The ( 5 > 2 || 3 < 5) results to true. This is because either 5 > 2OR3 < 5 should be true. Because 5 > 2 is true it doesn’t matter if 3 < 5 is true or false, this works both ways ofcourse.

So then we have 1 < 8ANDtrue. Both are true so in total we get: ( 1 < 8 && ( 5 > 2 || 3 < 5)) is true.

But because you have the !, the not-operator, in front of the statement. It gives the opposite outcome, for example:

The takeaway lesson here should be precedence, which is similar to algebraic order of operations, but the optimal term here.

Not to wave a flag, the example in post 3 shows the exact order, following precedence rules. The brackets are a very important part of the starting expression, and dictate precedence before we even begin to asses the operators.

Only one of the operands needs to be true for a yield of true. In this case both are, but since the first one is true, the second one is never evaluated.

We still cannot apply NOT (!) since there are still brackets.

!( 1 < 8 && true )
----- ----

Since the first operand is true, the result is true. That leaves,

! true

which toggles to false.

In Canadian schools a popular acronym in algebra is BEDMAS which can be shortened to BEMA since division is multiplication, and subtraction is addition.

Brackets
Exponents
Multiplication
Addition

In logical expressions, when there are no brackets,