Comperator not working

i have the following function :slight_smile:

if (speed <= 20)
{
low = true;
}
else if (speed => 74)
{
high = true;
}
else
{
low = false;
high = false;
}

the value of speed = 50
it always show high = true;

but infact 50 is not greater then 74

what am i doing wrong here ?

Shouldn't that be;
else if (speed >= 74)

1 Like

ohhh i had to remove the spaces

if (speed<20)
{
speedlow = speed;
timer = 30;
speed = 31;
low = true;
}
else if (speed>74)
{
speedhigh = speed;
timer = 10;
speed = 74;
high = true;
}
else
{
low = false;
high = false;
speedhigh = speed;
speedlow = speed;
}

is working

the spaces were not the issue. => is a completely different operator to >=

=> is a fat arrow (function) operator.
>= is the greater than or equals to operator.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.