== |
True if the expressions left and right of the operator are equal. |

!= |
True if the expressions left and right of the operator are not equal. |

> |
True if the expression
left of the operator is greater than
the expression right of the operator. |

>= |
True if the expression
left of the operator is greater than
or equal to the expression right of the operator. |

< |
True if the expression
right of the operator is greater than
the expression left of the operator. |

<= |
True if the expression
right of the operator is greater than
or equal to the expression left of the operator. |

and, && |
True if the expressions left and right of the operator are both true. |

or, || |
True if any one of the expressions left and right of the operator is true. |

not, ! |
True if the expression right of the operator is not true. |

() |
Brackets, for defining the priority of comparisions. Always use brackets when priority matters! |

- The "equals" comparison is done with '==', to differentiate
it from the assignment instruction with '
**=**'. Wrongly using '=' instead of '==' causes no error message from the compiler because it's a valid assignment, but is a frequent bug in scripts. - Comparing floating point variables
(
**var**,**double**,**float**,**DATE**) with '==' returns normally**false**because they are almost never absolutely identical. Only exception are simple cases such as comparison with**0**. Otherwise, use only**>**,**>=**,**<**,**<=**, or the between function for comparing floating point variables with each other. - For comparing the content of structs or arrays, compare their elements.
Strings can be compared with each other
with the strstr or strcmp functions.
For case insensitive comparing strings with string constants, (f.i.
**if(Asset == "EUR/USD) ...**) the operators**'=='**and '**!=**' can be also used. - The precedence of comparison and expression operators follows the C/C++ standard. Use parentheses in case of doubt. For instance, the expressions
**(x & y == z)**and**((x & y) == z)**give different results because the**&**operator has lower precedence than the**==**operator. - Unlike C/C++, lite-C evaluates all parts in a
**&&**or**||**comparison, even if one of it evaluates to false. Therefore, avoid constructs like**if (p && p->data == 1)..;**use**if (p) if (p->data == 1)..**instead.

10 < x// true if x is greater than 10(10 <= x) and (15 => x)// true if x is between 10 and 15!((10 <= x) and (15 => x))// true if x is less than 10 or greater than 15 (lite-C only)

► latest version online