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 trialSteven Hanna
203 PointsThis answer is FALSE the question reads AND which means that all must be correct. OR would mean any 1 item is sufficient
This answer is FALSE the question reads AND which means that all must be correct. OR would mean any 1 item is sufficient.
1 Answer
michael lynch
9,560 PointsHi Steven,
When we use OR(||) we are saying if side 1 is true OR side 2 is true then return true. Also long as one side is true it will return true. Example:
true || true will return true
true || false will return true
false || true will return true
When we use AND(&&) we are saying both sides must be true. Example:
false && true will return false
true && true will return true
But there are exceptions to this for example:
!false && false would return true
!false && true would return true
!true && true would return false
This is done using the NOT(!) operator
The correct answer for your related question is true It says assuming your count is set to 90 what is stored:
boolean answer = (count > 30 && count < 120);
substitute count for 90 (90 > 30) && (90 < 120) 90 is greater than 30 && 90 is less than 120. Both of which are true
Hope this helps a little Michael :)
Moderator Edit: Moved response from Comment Section to Answer Section