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
jahangir Rasheed
204 Points&& and ||
Assuming that Sara has taken the Java and Python tracks, what is the value of isFamiliar below:
boolean isFamiliar = ( learnedJava || learnedPython || learnedRuby );
i dont no how is this statement true ? its show sra has taken java and Python traks. not or. its should be learnedJava && ;earnedPython.
3 Answers
Gloria Dwomoh
13,116 Points"Assuming that Sara has taken the Java and Python tracks, what is the value of isFamiliar below:
boolean isFamiliar = ( learnedJava || learnedPython || learnedRuby );
i dont no how is this statement true ? its show sra has taken java and Python traks. not or. its should be learnedJava && ;earnedPython."
Lets break this down.
Sara has taken python and Java
isFamiliar gets true as long as 1 of the OR values comes out true.
So is Sara familiar with Java? Yes. So that sets isFamiliar to true. Since it is not && (AND) , but II (OR) it does not care of the other values being true or false. As long as one value is true everything is true.
jahangir Rasheed
204 Pointsthanks sara
Gloria Dwomoh
13,116 Pointsjahangir Rasheed umm my name is not sara
jahangir Rasheed
204 Pointssory gloria i want to wrote ur name than i saw name sara in question and i forgot ur name. thanks gloria
Gloria Dwomoh
13,116 PointsYou are welcome