I just encountered a weird problem this morning which make me wonder why all of a sudden this type of error occurs, look at this code for instance:
if(age == 0 || age == 47 || age = 99)
{
name = "Those are lucky numbers!";
}
else
{
name = "Try again...";
}
The error is: Error CS0019: Operator '||' cannot be applied to operands of type 'bool' and 'int'.
What the...? Hehe... I means type 'bool' and 'int' are the most frequent types we'll want to use with this kind of operations. Why wouldn't they work?
Furthermore, I'm sure I've done this thousands of time before, I don't understand why today it occurs... Or maybe I did this with the Ruby language. Still I truly have the feelings it worked before with C#.
Anyone have a logical explanation? Something I'm missing today? :D