Advanced | Help | Encyclopedia
Directory


Relational operator

(Redirected from Test operator)

In computer programming languages, a relational operator is a lexical unit used to express a relation, such as equality or greater than, between two expressions. Two suitable expressions combined with a relational operator often form a relational expression or condition in a programming language.

For example, in many programming languages, the relational operator that tests the equality of two expressions has this form:

X == Y

Relational operators are usually written in infix notation, if supported by the programming language, which means that they appear between their operands (the two expressions being related). However, some programming languages, such as Lisp, use prefix notation, as follows:

(= X Y)

Here are some of the most common relational operators in use in programming languages:

Common Relational Operators
Relational
Operator
Meaning
== Equality. Used to test the equivalence of two expressions.
= Variant of equality.
!= Inequality. Used to test the equivalence of two expressions.
<> Variant of inequality.
/= Variant of inequality. This is not as common as the above operator.
^= Variant of inequality. This is not as common as the above operator. (Also a bitwise XOR assignment in C-like languages.)
> Greater than. Used to test if the value of the left expression is greater than that of the right expression.
< Less than. Used to test if the value of the left expression is less than that of the right expression.
>= Greater than or equal to. Used to test if the value of the left expression is greater than or equal to that of the right expression.
<= Less than or equal to. Used to test if the value of the left expression is less than or equal to that of the right expression.
=< Variant of less than or equal to.

See also








Links: Addme | Keyword Research | Paid Inclusion | Femail | Software | Completive Intelligence

Add URL | About Slider | FREE Slider Toolbar - Simply Amazing
Copyright © 2000-2008 Slider.com. All rights reserved.
Content is distributed under the GNU Free Documentation License.