I am trying to write an assertion statement to check and see if the users letter entered is between A and Z. This is the code I have:
assert((letter >= 'a' && letter <= 'z') || (letter >= 'A' && letter <= "Z")):"The letter you entered was incorrect";
I am getting a
Bad operand type for binary operator '<='
error.
Any help or tips would be much appreciated. :)
You mean 'Z'
, not "Z"
.
They are not the same: the first is a char literal, the second is a string literal. Comparison operators are not defined for Strings, or reference types in general.