Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on exercise 09 in chapter 03 #4

Closed
zamatta opened this issue Feb 17, 2023 · 1 comment
Closed

Error on exercise 09 in chapter 03 #4

zamatta opened this issue Feb 17, 2023 · 1 comment

Comments

@zamatta
Copy link

zamatta commented Feb 17, 2023

The condition below seems to be incorrect.

bool isOutsideRectangle = (x < -1 && x > 5 && y < 1 && y > 5) ? true : false;

how can x = -2 will x < -1 && x > 5 at the same time.

The correct condition is:

bool isOutsideRectangle = (x < -1 || x > 5) && (y < 1 || y > 5) ? true : false;
@ivanpop
Copy link
Owner

ivanpop commented Feb 18, 2023

Yes. You're condition is the correct one.

@ivanpop ivanpop closed this as completed Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants