D
D
Dymetrey2017-10-03 19:34:39
C++ / C#
Dymetrey, 2017-10-03 19:34:39

Operator || and == cannot be applied to operands of type string and int?

int day;
if (day == "Monday" || day == "Monday" || day == "1") {

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
eRKa, 2017-10-03
@Klirik_High

C# is a strongly typed language, not js. Therefore, you can only compare a string with a string and an int with an int.

M
MrDywar Pichugin, 2017-10-03
@Dywar

Start by reading a book or website on C#.
https://metanit.com/sharp/

D
Denis Zagaevsky, 2017-10-03
@zagayevskiy

You cannot compare string "..." and number(int).

J
John_Nash, 2017-10-04
@John_Nash

Can not. || only requires bool which == and returns

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question