# error: result of comparison of constant with boolean expression is always true

So, I want to make a do-while loop, repeating the question for an input, so check if the input is in a range between 340000000000000 or 379999999999999 and my code is generating a compilation error:

error: result of comparison of constant 379999999999999 with boolean expression is always true

Ok, I mean, how? If the input is 389999999999935 for example, so the bool for this if is FALSE... why it keep saying that the result of comparison is always true?

''' int main(void) { long cardNum;

do { cardNum = get_long("Card number:\n"); } while (cardNum <= 0);

if (340000000000000 <= cardNum <= 379999999999999) { '''

Instead of long, use unsigned long long int to hold very long numbers. Check out man.cs50.io for a function to take a long long int.

If this helped, please click the tick mark.

• Say what? I have no idea what "long long int" means... and I looked at man.cs50.io and there's not mention to "long long int" anywhere... could you please explain further what this funtion is and how to use it? I'm a very beginner.... Jun 3 '20 at 11:26

I tried as suggested and edited my code to:

int main(void)
{
long long int cardNum;

do
{
cardNum = get_long_long("Card number:\n");
}
while (cardNum <= 0);

if (340000000000000 <= cardNum < 380000000000000)
{

and I still get the same error message:

error: result of comparison of constant 380000000000000 with boolean expression is always true