music
OSdata.com: programming text book 

OSdata.com

Booleans

summary

    Representing Boolean values in a computer.

free computer programming text book project

table of contents
If you like the idea of this project,
then please donate some money.
more information on donating

Google

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.

Booleans

    Representing Boolean values in a computer.

Boolean type

    The Boolean type is used to store Boolean values. Boolean values are TRUE or FALSE. Some programming languages have a specific Boolean type and others don’t. In languages that don’t have a specific Boolean type, some other system must be used. In PL/I a bit is set to either '0'B or '1'B. In COBOL a text word is used, such as the combination of 'TRUE' and 'FALSE' or 'YES' and 'NO'. In C an integer is used and the the Boolean values are represented by the combination of one for TRUE and 0 for FALSE.

ALGOL 68

    In ALGOL 68 the Boolean mode is declared with the reserved word bool.

bool    SimpleFlag;

FORTRAN

    FORTRAN IV introduced the LOGICAL type and the truth literals .TRUE. and .FALSE., as well as the logical operators .AND., .OR., and .NOT., and the FORMAT control characterL.

LOGICAL    L1, L2, L3

LISP

    LISP uses the empty list for FALSE and any other value for TRUE.

Pascal

    In Pascal the Boolean type is declared with the reserved word boolean.

var    Flag: boolean;

PL/I

    PL/I does not have an explicit Boolean type, using a single bit instead. PL/I Boolean expressions (such as in IF and WHILE expressions) evaluate to a single bit.

Python

    Python includes the core built-in type bool.

    bool(x)

    Evaluates the argument x and returns False if the argument x evaulates to flase or returns True if the argument evaulates as true.

    bool is a subclass of int.

    The only two instances of type bool are False and True. False is also an integer equal to 0 and True is also an integer equal to 1. str(True) evaluates to 'True' and str(False) evaluates to 'False'.

SQL

    SQL allows for four Boolean values: TRUE, FALSE, UNKNOWN, and NULL (but allowed vendors to combine unknown and null into a single entity).

Stanford C essentials

    Stanford CS Education Library This [the following section until marked as end of Stanford University items] is document #101, Essential C, in the Stanford CS Education Library. This and other educational materials are available for free at http://cslibrary.stanford.edu/. This article is free to be used, reproduced, excerpted, retransmitted, or sold so long as this notice is clearly reproduced at its beginning. Copyright 1996-2003, Nick Parlante, nick.parlante@cs.stanford.edu.

No Boolean -- Use int

    C does not have a distinct boolean type-- int is used instead. The language treats integer 0 as false and all non-zero values as true. So the statement…

    i = 0;
    while (i - 10) {
       ...

    will execute until the variable i takes on the value 10 at which time the expression (i - 10) will become false (i.e. 0). (we’ll see the while() statement a bit later)

    Stanford CS Education Library This [the above section] is document #101, Essential C, in the Stanford CS Education Library. This and other educational materials are available for free at http://cslibrary.stanford.edu/. This article is free to be used, reproduced, excerpted, retransmitted, or sold so long as this notice is clearly reproduced at its beginning. Copyright 1996-2003, Nick Parlante, nick.parlante@cs.stanford.edu.

end of Stanford C essentials

Ada

    “31 Every object in the language has a type, which characterizes a set of values and a set of applicable operations. The main classes of types are elementary types (comprising enumeration, numeric, and access types) and composite types (including array and record types).” —:Ada-Europe’s Ada Reference Manual: Introduction: Language Summary See legal information

    “32/2 An enumeration type defines an ordered set of distinct enumeration literals, for example a list of states or an alphabet of characters. The enumeration types Boolean, Character, Wide_Character, and Wide_Wide_Character are predefined.” —:Ada-Europe’s Ada Reference Manual: Introduction: Language Summary See legal information


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).


return to table of contents
free downloadable college text book

view text book
HTML 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
previous page next page

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,
then please donate some money.

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)

more information on donating

Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.


Google


Made with Macintosh

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

Viewable With Any Browser


    †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.

    Copyright © 2010, 2011 Milo

    Created: December 12, 2010

    Last Updated: January 14, 2011


return to table of contents
free downloadable college text book

previous page next page
previous page next page