1. Computing & Technology

Discuss in my forum

Definition of OR

By , About.com Guide

Definition: OR is an operation between two bits. If either bit is set then the result is set. If both are clear, the result is clear. This can be shown as below.
 A B --- A OR B
 0 0 ----- 0
 0 1 ----- 1
 1 0 ----- 1
 1 1 ----- 1
 
In C, C++ and C# binary OR is represented by a single pipe character |.

In expressions, OR is represented by the double pipe character || as in

 if (a==2) || (a==3) { //.. rest of code 
Which means if a equals 2 or a equals 3

Glossary:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Examples:
OR is often used to combine bytes together.

©2012 About.com. All rights reserved.

A part of The New York Times Company.