# Comperator not working

**URL:** https://discourse.nodered.org/t/comperator-not-working/44697
**Category:** General
**Created:** [25 April 2021 13:07 UTC](https://discourse.nodered.org/t/comperator-not-working/44697 "2021-04-25T13:07:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Doebe](https://avatars.discourse-cdn.com/v4/letter/d/977dab/32.png) [@Doebe](https://discourse.nodered.org/u/Doebe)
#### Post date: [25 April 2021 13:07 UTC](https://discourse.nodered.org/t/comperator-not-working/44697/1 "2021-04-25T13:07:21Z")

</div>

i have the following function 🙂

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 ?

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [25 April 2021 13:15 UTC](https://discourse.nodered.org/t/comperator-not-working/44697/2 "2021-04-25T13:15:28Z")

</div>

> [@Doebe](#):
>
> else if (speed =\> 74)

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

---

<div class="post-metadata">

### Author: ![Doebe](https://avatars.discourse-cdn.com/v4/letter/d/977dab/32.png) [@Doebe](https://discourse.nodered.org/u/Doebe)
#### Post date: [25 April 2021 13:16 UTC](https://discourse.nodered.org/t/comperator-not-working/44697/3 "2021-04-25T13:16:31Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [25 April 2021 13:49 UTC](https://discourse.nodered.org/t/comperator-not-working/44697/4 "2021-04-25T13:49:33Z")

</div>

> [@Doebe](#):
>
> ohhh i had to remove the spaces

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.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [24 June 2021 13:50 UTC](https://discourse.nodered.org/t/comperator-not-working/44697/5 "2021-06-24T13:50:19Z")

</div>

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