This is known as Boolean Logic.

1 represents true and 0 represents false.

In the first evaluation, true or false evaluates to true; therefore, not true or false or !(1 || 0) evaluates to 0.

In the second evaluation, we know that *and* evaluates before *or*. So, we can place parenthesis to make it a little more clear and go from there.

Code:

!( 1 || 1 && 0 ) == !( 1 || ( 1 && 0 ) )

So, taking it piece by piece, the first evaluation will be 1 && 0 (true and false) which evaluates to false. So, we can replace that evaluation with a 0 to get:

Code:

!( 1 || 1 && 0) == !( 1 || ( 0 ) )

which is reduced to true or false, the same as the first evaluation, which we know evaluates to true. Therefore, since this is negated by the !, this is false or 0.

In the final evaluation, we have:

Code:

!( ( 1 || 0 ) && 0 )

Following from the second example, we will evaluate the part in parenthesis first which is our familiar friend true or false and we know that evaluates to true. So, let's replace that to get:

We know that true and false is false, so we negate that to get true.

I hope this helps.