Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

MIchael Montoya
3,222 Points(!true || !false) && (true && !false) I don't understand why the result of this is true.
I thought it would be false. Can someone explain this to me?
2 Answers

Jason Anders
Treehouse Moderator 145,862 PointsHey Michael...
The 'wonderful' (note sarcasm) world of Logical Operators...
Hopefully, I can clear this up for you by breaking it down...
The first part (!true || !false) is using OR, so only one of the conditions needs to be true to return true. "not true" is false, so it's not that one, but "not false" is true, so the left part of the check returns true.
The second part (true && !false) is using AND, so both need to be true in order to return true. "true", well obviously is true, and "not false" is also true, so both side equal true and there the right part returns true.
Now the whole condition is an AND, so both sides need to be true. We know the right side returns true and the left side returns true; therefore, the whole condition will return true.
I hope that helped. :)

MIchael Montoya
3,222 PointsSure did!
I must have missed the part where only one side of the || needed to be true for the entire part to be true.
Thanks for the detailed response!