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 trialAdi Jain
2,771 PointsWhat do I do I'm not sure I used Ampersands, but I'm not sure if I used them the right way!
Change the value of inchesTall to 64. Then, create a conditional statement which assigns a value of true to isMediumSize if inchesTall is greater than 48 and less than 68. This is the question I forgot how to use the ampersands they still confuse me please help!
bool isMediumSize;
int inchesTall = 64;
if (inchesTall > 48 && inchesTall < 68) {
inchesTall = true;
}
1 Answer
Cyrus Walker
13,801 Points&& (or AND) means that both conditions must be true in order for the code within the If Statement to run. So yes you used the AND operator correctly!
Although inchesTall is the integer and isMediumSize is the Boolean. So, you would want to have "isMediumSize = true" and Not "inchesTall = true" within the If Statement.
Good job! Keep it up!
Here's more information on Objective-C operators: http://www.tutorialspoint.com/objective_c/objective_c_operators.htm
Adi Jain
2,771 PointsAdi Jain
2,771 PointsThank you I realized the difference that made.