cgg
cgg

Reputation: 85

Why I get "Operator '||' cannot be applied to operands of type 'bool' and 'int'" error?

int UserA;

Console.WriteLine("What is 5 + 5");
UserA = Convert.ToInt32(Console.ReadLine());
if(UserA == 10) {
    Console.WriteLine("Correct!");
} else if(UserA == 9 || 11 ) {

}

Why am I not able to use the OR operand here. I know its simple but I am quite stuck.

Upvotes: 0

Views: 1156

Answers (1)

currarpickt
currarpickt

Reputation: 2302

It supposed to be:

UserA == 9 || UserA == 11

Upvotes: 7

Related Questions