|
A comparison operator in computer programming is a binary operator. The application of the operator usually returns a Boolean value indicating whether the comparison holds. Computer programming (often shortened to programming or coding) is the process of writing, testing, and maintaining the source code of computer programs. ...
In mathematics, a binary operation, or binary operator, is a calculation involving two input quantities and one kind of a specific operation. ...
The adjective Boolean [], coined in honor of George Boole, is used in many contexts: An evaluation that results in either of the truth values true or false. A Boolean value is a truth value, either true or false, often coded 1 and 0, respectively. ...
Equality operator
An equality operator is one type of comparison operator usually represented as either = (ex. BASIC) or == (ex. C, C++, and Java). The meaning of equality often depends on the programming language and on the values being compared. In addition, an equality operator does not always meet the requirements of an equivalence relation, especially in programming languages which allow operator overloading. BASIC (Beginners All-purpose Symbolic Instruction Code) is a family of high-level programming languages. ...
Wikibooks has a book on the topic of C Programming The C programming language (often, just C) is a general-purpose, procedural, imperative computer programming language developed in the early 1970s by Dennis Ritchie for use on the Unix operating system. ...
C++ (pronounced see plus plus, IPA: ) is a general-purpose, high-level programming language with low-level facilities. ...
Java is an object-oriented applications programming language developed by Sun Microsystems in the early 1990s. ...
In mathematics, an equivalence relation, denoted by an infix ~, is a binary relation on a set X that is reflexive, symmetric, and transitive. ...
A programming language is an artificial language that can be used to control the behavior of a machine, particularly a computer. ...
In computer programming, operator overloading (less commonly known as operator ad-hoc polymorphism) is a specific case of polymorphism in which some or all of operators like +, = or == have different implementations depending on the types of their arguments. ...
Inequality operators inequality operators are another type of comparison operator. There are usually five inequality operators <, <=, >, >=, and !=. As with equality operators, the comparison usually, but does not always meet the requirements of a total order (for non-strict inequalities) or a strict weak ordering (for strict inequalities), especially in programming languages which allow operator overloading. In mathematics, a total order, linear order or simple order on a set X is any binary relation on X that is antisymmetric, transitive, and total. ...
A strict weak ordering is a binary relation that defines an equivalence relation and has the properties stated below. ...
A programming language is an artificial language that can be used to control the behavior of a machine, particularly a computer. ...
In computer programming, operator overloading (less commonly known as operator ad-hoc polymorphism) is a specific case of polymorphism in which some or all of operators like +, = or == have different implementations depending on the types of their arguments. ...
< The operator < (called "less than") returns true if its first operand evaluates to less than the second operand, and returns false otherwise. In mathematics, an operand is one of the inputs (arguments) of an operator. ...
<= The operator <= (called "less than or equal to") returns true if its first operand evaluates to less than the second operand or if the operands are equal, it returns false otherwise.
> The operator > (called "greater than") returns true if its first operand is greater than its second, and returns false otherwise.
>= The operator >= (called "greater than or equal to") returns true if its first operand is greater than its second or if the two operands are equal, and returns false otherwise.
!= The operator != (called "not equal") returns true if its operands are not equal and false otherwise. This operand appears in some languages as <>.
Logical equivalence Though perhaps not obvious at first, like the boolean logical operators XOR, AND, OR, and NOT, the comparison operators have logical equivalence such that they can all be defined in terms of one another. (x < y) == (y > x) == not(x >= y) == not(y <= x) (y < x) == (x > y) == not(y >= x) == not(x <= y)
See also |