I need abit of help with an if statement and operators. How could I do this:
double AgePenalty = 0;
if (AgeOfCustomer <= 21)
{
AgePenalty = 15;
}
if (AgeOfCustomer <= 30 && AgeOfCustomer => 21) // cant use && operator with double
{
AgePenalty = 10;
}
This just says if the customer is younger than 21 apply a certain price tag; if the customer is between the ages of 21 and 25 apply smaller price tag etc.
It’s not
&&that’s the problem – it’s your greater-than-or-equal-to operator, which is>=, not=>.=>is used for lambda expressions.(It’s not clear why you thought this was related to doubles particularly…)