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 trialMalala Jung
986 PointsPlease help with this question, it doesnt make sense.
Assuming age is set to 42, what is the value stored in the boolean answer:
boolean answer = (age < 40 || age > 50);
4 Answers
Grigorij Schleifer
10,365 PointsHi Mayie,
|| is logical or operator. || combines two boolean variables or expressions and returns a result that is true if either or both of its operands are true.
So if the age is 42 the result will be false. Every age beetween 40 and 50 will result false.
Malala Jung
986 PointsThank you, I got it now.
David Hinton
3,070 PointsThank you Grigorij Schleifer, that also helped me
Ashish Shah
1,468 PointsNo this is not true , it has to be either or so 1 condition is true than other does not matter
Ashish Shah
1,468 PointsAshish Shah
1,468 PointsNo this is not true , it has to be either or so 1 condition is true than other does not matter