Help Asap! 5.Boolean Operators : Precedence

	// ( !true || (false && true) )
	boolean puzzle = true;

Set the boolean variable puzzle equal to the Boolean result of the single line comment directly above it.


You only have two options there, and the one you tried didn't work. :smile:


:unamused: gee thanks for the help.


I can give you a walkthrough on how to get from that ugly equation to true if you'd like -- I didn't mean to be so short.


please do,i would really appreciate it. :blush:


Here is the precedence order for evaluating boolean expressions:

  • brackets
  • !
  • &&
  • ||

We are starting off with

!true || (false && true)

Brackets have the highest precedence so we evaluate those first. The && operator returns true only when both sides are true. That leaves us with:

!true || false

! has the next highest precedence. The ! operator returns the opposite. That leaves us with:

false || false

The || operator returns true when at least one side is true. That leaves us with: