Binary Operator

Definition - What does Binary Operator mean?

A binary operator is an operator that operates on two operands and manipulates them to return a result. Operators are represented by special characters or by keywords and provide an easy way to compare numerical values or character strings.

Binary operators are presented in the form:

Operand1 Operator Operand2

Techopedia explains Binary Operator

Some common binary operators in computing include:

  • Equal (==)
  • Not equal (!=)
  • Less than (<)
  • Greater than (>)
  • Greater than or equal to (>=)
  • Less than or equal to (<=)
  • Logical AND (&&)
  • Logical OR (||)
  • Plus (+)
  • Minus (-)
  • Multiplication (*)
  • Divide (/)

Equal (==) and not-equal (!=) are called equality operators. They produce a result of true (or 1) or false (or 0). This type of operator returns "true" if both operands have the same value, or "false" if they don’t have the same value.

For example, the following conditional operation will be performed if the operands are equal:

if(operand1 == operand2)
//do the operation

Greater than (>), less than (<), greater than or equal to (>=) and less than or equal to (<=) are relation operators, which compare two operands and produce a result of either true or false. When two operands are compared, the result depends on the relative location of the two operands.

Logical AND (&&) and logical OR (||) are called logical operators. They compare operands and return a result of either true (1) or false (0). In logical AND, if both operands are true then the result is true. If either one of the operands is false, the result will be false. In logical OR, if both operands are true or either one of the operands is true then the result is true. If both operands are false then the result will be false.

Share this:

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.