DiGrande.it

Blind, Braille and Embossing Technologies

This site uses cookies to personalize content and ads, provide social media features and analyze links. By closing this banner or continuing to browse, you consent to their use.
Read the DiGrande.it Cookie Policy

Relational operators

Relational operators are used to make a comparison between values producing as a result of return a Boolean value (TRUE or FALSE) as a product of the comparison. They are mainly used in the IF THEN ELSE conditional structure, but can also be used when assigning boolean values to variables or when passing parameters to instructions.

- VALUE1 OPERATOR VALUE2

The relational operators are as follows.

- (equal) Equality operator. Returns TRUE only if the first value is equal to the second;

- <> (other than) Operator of inequality. Returns TRUE only if the first value is different from the second;

- > (greater than) Majority operator. Returns true only if the first value is greater than the second;

- >= (greater than or equal to) Majority or equality operator. Returns true only if the first value is greater than or equal to the second;

- < (less than) Minority operator. Returns true only if the first value is less than the second;

- <= (less than or equal to) Minority or equality operator. Returns true only if the first value is less than or equal to the second.

The equality relational operator should not be confused with the assignment operator, which is used to assign a value to a variable. For example:

- C = 5

The "=" symbol is the assignment operator that instructs the user agent to assign the value 5 to variable C.

- C = 5=6

- The first symbol of equal is always the assigning operator, while the equal that relates the two values is the relational equality operator. In this case variable C is assigned the FALSE boolean value, since the value 5 is not equal to 6.