0

Originally, my if statements looked like these (please note that I didn't really write them one after the other like this):

if (counterCardLength == 15 && FindFirstTwoDigits == 34 | 37)

if (a == 1 | 3 | 5 | 7 | 9 | 11 | 13)

Then the compiler gave me an error that told me that '==' would be evaluated first and that I should either place parentheses around '==' to silence the warning or around '|' to evaluate that side first. I have tried doing both of these things but still keep receiving the error "expected expression" with the part in new parentheses indicated.

I have tried all of these:

if (counterCardLength == 15 && FindFirstTwoDigits == 34 (|) 37)

if (a == 1 (|) 3 | 5 | 7 | 9 | 11 | 13)

if (counterCardLength == 15 && FindFirstTwoDigits (==) 34 | 37)

if (a (==) 1 | 3 | 5 | 7 | 9 | 11 | 13)

if (counterCardLength == 15 && FindFirstTwoDigits (==) 34 (|) 37)

if (a (==) 1 (|) 3 | 5 | 7 | 9 | 11 | 13)

Does anyone know what might be wrong? Thanks in advance.

1 Answer 1

1

To evaluate the right side first we must put the parentheses on the right side of the identity, not the operator == itself

if (counterCardLength == 15 && FindFirstTwoDigits == (34 | 37))

if (a == (1 | 3 | 5 | 7 | 9 | 11 | 13))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .