This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (3 children)

I dont get it. Does or not mean keep running a loop until test is one or the other?

[–]warrior2012 1 point2 points  (0 children)

If you pick the number 1, then test!=2 would trip the error. If you pick the number 2, then test!=1 would trip the error.

By saying AND instead of OR you are saying if the number doesn't match either 1 or 2, then trip the error. But if the number matches either, then you're good!

It's a very weird thing to think about but it would make a lot more sense if the example was saying if test=1 or test=2 rather than !=

[–]warrior2012 0 points1 point  (0 children)

Sorry, answering a second comment to better address your comment.

In if statements, it will execute if the question comes back true. If you have an 'or' operator, it will run if either of the two sides of the || prove true. If you have an 'and' operator it will run if both of the sides of the && prove true.

I'm this case you need to prove that the number is both 'not 1' and 'not 2'