music

# Boolean OR

## summary

This subchapter looks at Boolean OR.

## free computer programming text book project

If you like the idea of this project,

### stub section

This subchapter is a stub section. It will be filled in with instructional material later. For now it serves the purpose of a place holder for the order of instruction.

Professors are invited to give feedback on both the proposed contents and the propsed order of this text book. Send commentary to Milo, PO Box 1361, Tustin, California, 92781, USA.

# Boolean OR

This subchapter looks at Boolean OR.

Please note the differences between a logical Boolean operation, an integer Boolean operation, and a bit-wise Boolean operation. Note that terminology varies, so you will eventually see references using these terms different than presented here.

In the case of a logical Boolean OR, the result is a logical BOOLEAN type of either TRUE or FALSE. Some languages, such as C, do not have a built-in Boolean type. There are several different and incompatible encodings for TRUE and FALSE (see table below).

In the case of an integer Boolean OR, the OR is performed on the two integers as whole numbers. The result can be inaccurate if the integer is not in a specified form (the legal options usually being [ZERO and ONE] or [ZERO and NEGATIVE ONE]. This works best with -1 and 0 as TURE and FALSE (or vice versa). There are several different and incompatible encodings for TRUE and FALSE (see table below).

somelanguages TRUE FALSE C 1 0 C non-zero zero negative zero orpositive -1 0 0 1

in the case of a bit-wise Boolean OR, a logical OR is performed on each corresponding bit of the two bit strings (or two single bits).

### OR

OR (or inclusive or) requires either object to be true for the result to be true. The OR works like a pair of switches in parallel. Current will flow if either or both switches are closed.

OR is conisdered to be Boolean addition and is represented by the plus symbol: + (such as (A+B). There is no Boolean subtraction operation.

The truth table for OR is as follows:

OR
ABresult
000
101
011
111

The OR gate in logic circuits looks like:

The OR operation has a result of 1 when any of its input variables is 1.

The OR operation has a result of 0 only when both of its input variables are 0.

In OR (Boolean addition) 1 + 1 = 1. Similarly, 1 + 1 + 1 = 1.

### OR functions

Some languages have an OR function.

LISP    OR(x) — LISP predicate function that takes zero or more arguments of type NIL or nonNIL and returns either NIL or nonNIL. Arguments are evalutaed left to right. Evaluation stops at the first nonNIL and remaining arguments are not evaluated, returning the nonNIL argument. If the function evaluates all of the arguments and finds only NIl values, then it returns NIL.

# free music player coding example

Coding example: I am making heavily documented and explained open source code for a method to play music for free — almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).

View music player in action: www.musicinpublic.com/.

Create your own copy from the original source code/ (presented for learning programming).

## view text bookHTML file

Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.

 previous page next page
 Tweets by @osdata

## free computer programming text book project

Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.

If you like the idea of this project,

send donations to:
Milo
PO Box 1361
Tustin, California 92781

Supporting the entire project:

If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)

Some or all of the material on this web page appears in the

This web site handcrafted on Macintosh computers using Tom Bender’s Tex-Edit Plus and served using FreeBSD .

†UNIX used as a generic term unless specifically used as a trademark (such as in the phrase “UNIX certified”). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.

Names and logos of various OSs are trademarks of their respective owners.