I just got through the third lesson and was making some simple programs to practice what I learned. One of which is as follows (my question is mainly about the bold part):

Code:

#include <stdio.h>
int main()
{
int x;
for (x = 0; x <=5 ; x++){
**if (x == (1 || 3)**){
continue;}
printf("x is %d and not 1 or 3.\n", x);
}
return 0;
}

It yields the following output:

x is 0 and not 1 or 3.

x is 2 and not 1 or 3.

**x is 3 and not 1 or 3.**

x is 4 and not 1 or 3.

x is 5 and not 1 or 3.

When I wrote this, I was expecting the program to not output the "x is 1..." and "x is 3..." statements. Surely enough, it didn't output the "x is 1..." line, but it produced the "x is 3..." line, which confuses me. By using the OR operator on the bold part of the code, I expected it to be read as "if x is 1 or 3, continue the loop." It did this for x == 1, but it didn't do this for x == 3, which leaves me quite puzzled. I know I can write it as "x == 1 || x == 3," but I was trying to find a more efficient way to do it.

Could some explain how the statement is being read in the program that makes it not produce the "x is 1..." line but produce the "x is 3..." line? Any other suggestions on how to achieve the result I want?

Much obliged.