m.kelas-karyawan-ftumj.prestasi.web.id Layanan Informasi 17 Jam
Telp/Fax : 021-8762002, 8762003, 8762004, 87912360
HP/SMS : 081 1110 4824 27, 0812 9526 2009, 08523 1234 000
WhatsApp : 0817 0816 486, 0812 9526 2009
email : _Hubungi Kami__ silahkan klik
Chatting dengan Staf :
ggkarir.com
ggiklan.com
Pilih Bahasa :   ID   EN   Permintaan Katalog / Brosur (GRATIS via POS)   Kelas Karyawan   Reguler
S1 Ushuludin / Perbandingan AgamaJaringan EnsiklopediaSejarahApache ServerInternetIslam

   
Cari  
    Teknik Telekomunikasi

    Sebelumnya  (Boolean algebra) (Boolean domain)  Berikutnya    

Boolean data type

In computer science, the Boolean or logical data type is a data type, having two values (usually denoted true and false), intended to represent the truth values of logic and Boolean algebra. It is named after George Boole, who first defined an algebraic system of logic in the mid 19th century. The Boolean data type is the primary result of conditional statements, which allow different actions and change control flow depending on whether a programmer-specified boolean condition evaluates to true or false.

Contents

Generalities

In programming languages that have a built-in Boolean data type, such as Pascal and Java, the comparison operators such as > and are usually defined to return a Boolean value. Conditional and iterative commands may be defined to test Boolean-valued expressions.

Languages without an explicit Boolean data type, like C90 and Lisp, may still represent truth values by some other data type. Lisp uses an empty list for false, and any other value for true. C uses an integer type, where relational expressions like i > j and logical expressions connected by && and || are defined to have value 1 if true and 0 if false, whereas the test parts of if, while, for, etc., treat any non-zero value as true.[1][2] Indeed, a Boolean variable may be regarded (and be implemented) as a numerical variable with a single binary digit (bit), which can store only two values. It is worth noting that the implementation of booleans in computers are most likely represented as a full byte, rather than a bit; this is usually due to the ways computers transfer blocks of information.

Most programming languages, even those that do not have an explicit Boolean type, have support for Boolean algebraic operations such as conjunction (AND, &, *), disjunction (OR, |, +), equivalence (EQV, =, ==), exclusive or/non-equivalence (XOR, NEQV, ^, !=), and not (NOT, ~, !).

In some languages, like Ruby, Smalltalk, and Alice the "true" and "false" values belong to separate classes—e.g. True and False, resp.—so there is no single Boolean "type."

In SQL, which uses a three-valued logic for explicit comparisons because of its special treatment of Nulls, the Boolean data type (introduced in SQL:1999) is also defined to include more than two truth values, so that SQL "Booleans" can store all logical values resulting from the evaluation of predicates in SQL. A column of Boolean type can also be restricted to just TRUE and FALSE though.

In the lambda calculus model of computing, Boolean values can be represented as Church booleans.

ALGOL, Java, and C#

One of the earliest languages to provide an explicit Boolean data type was ALGOL 60 (1960) with values true and false and logical operators denoted by symbols '\wedge' (and), '\vee' (or), '\supset' (implies), '\equiv' (equivalence), and '\neg' (not). Due to input device limitations of the time, however, most compilers used alternative representations for the latter, such as AND or 'AND'.

This approach ("Boolean is a separate built-in primitive data type") was adopted by many later languages, such as ALGOL 68 (1970),[3] Java, and C#.

Fortran

The first version of FORTRAN (1957) and its successor FORTRAN II (1958) did not have logical values or operations; even the conditional IF statement took an arithmetic expression and branched to one of three locations according to its sign; see arithmetic IF. FORTRAN IV (1962), however, followed the ALGOL 60 example by providing a Boolean data type (LOGICAL), truth literals (.TRUE. and .FALSE.), Boolean-valued numeric comparison operators (.EQ., .GT., etc.), and logical operators (.NOT., .AND., .OR.). In FORMAT statements, a specific control character ('L') was provided for the parsing or formatting of logical values.[4]

Lisp and Scheme

The Lisp language (1958) never had a built-in Boolean data type. Instead, conditional constructs like cond assume that the logical value "false" is represented by the empty list (), which is defined to be the same as the special atom nil or NIL; whereas any other s-expression is interpreted as "true". For convenience, most modern dialects of Lisp predefine the atom t to have value t, so that one can use t as a mnemonic notation for "true".

This approach ("any value can be used as a Boolean value") was retained in most Lisp dialects (Common Lisp, Scheme, Emacs Lisp), and similar models were adopted by many scripting languages, even ones that do have a distinct Boolean type or Boolean values; although which values are interpreted as "false" and which are "true" vary from language to language. In Scheme, for example, the "false" value is an atom distinct from the empty list, so the latter is interpreted as "true".

Pascal, Ada, and Haskell

The Pascal language (1978) introduced the concept of programmer-defined enumerated types. A built-in Boolean data type was then provided as a predefined enumerated type with values FALSE and TRUE. By definition, all comparisons, logical operations, and conditional statements applied to and/or yielded Boolean values. Otherwise, the Boolean type had all the facilities which were available for enumerated types in general — such as ordering and use as indices. On the other hand, the conversion between Booleans and integers (or any other types) still required explicit tests or function calls, as in ALGOL 60. This approach ("Boolean is an enumerated type") was adopted by most later languages which had enumerated types, such as Modula, Ada and Haskell.

C, C++, Objective-C, Awk, Perl, Python

The initial implementations of the C language (1972) provided no Boolean type, and to this day Boolean values are commonly represented by integers (ints) in C programs. The comparison operators ('>', '==', etc.) are defined to return a signed integer (int) result, either zero (for false) or 1 (for true). The same convention is assumed by the logical operators ('&&', '||', '!', etc.) and condition-testing statements ('if', 'while').

After enumerated types (enums) were added to the ANSI version of C (1989), many C programmers got used to defining their own Boolean types as such, for readability reasons. However, enumerated types are equivalent to integers according to the language standards; so the effective identity between Booleans and integers is still valid for C programs.

Standard C (since C99) and several dialects of C such as and Objective-C provide definitions of a Boolean type as an integer type and macros for "false" and "true" as 0 and 1, respectively. Thus logical values can be stored in integer variables, and used anywhere integers would be valid, including in indexing, arithmetic, parsing, and formatting. This approach ("Boolean values are just integers") has been retained in all later versions of C.

C++ has a separate Boolean data type ('bool'), but with automatic conversions from scalar and pointer values that are very similar to those of C. This approach was adopted also by many later languages, especially by some scripting ones such as AWK. One problem with this approach is that the tests if(t==TRUE){...} and if(t) are not equivalent. Python has a related situation, where the Boolean type, bool is a subtype of the integer type, int, and Booleans False and True act as 0 and 1, respectively, in arithmetic contexts.

Python, Ruby, and JavaScript

In Python, a numeric value of zero (integer or fractional), the null value (None), the empty string, and empty containers (i.e. lists, sets, etc.) are considered Boolean false; all other values are considered Boolean true by default. Classes can define how their instances are treated in a Boolean context through the special method __nonzero__ (Python 2) or __bool__ (Python 3).

In Ruby, on the other hand, only nil (Ruby's null value) and a special false object are "false", everything else (including the integer 0 and empty arrays) is "true".

In JavaScript, the empty string (""), null, undefined, NaN, +0, −0 and false[5] are sometimes called "falsy", and their complement, "truthy", to distinguish between strictly type-checked and coerced Booleans.[6] Languages such as PHP also use this approach.

SQL

The SQL:1999 standard introduced a BOOLEAN data type as an optional feature (T031). When restricted by a NOT NULL constraint, a SQL BOOLEAN behaves like Booleans in other languages. In SQL however, the BOOLEAN type is nullable by default like all other SQL data types, meaning it can have the special null value as well. Although the SQL standard defines three literals for the BOOLEAN type—TRUE, FALSE and UNKNOWN—, it also says that the NULL BOOLEAN and UNKNOWN "may be used interchangeably to mean exactly the same thing".[7][8] This has caused some controversy because the identification subjects UNKNOWN to the equality comparison rules for NULL. More precisely UNKNOWN = UNKNOWN is not TRUE but UNKNOWN/NULL.[9] As of 2012 few major SQL systems implement the T031 feature.[10] PostgreSQL is a notable exception, although it does not implement the UNKNOWN literal; NULL can be used instead.[11] (PostgreSQL does implement the IS UNKNOWN operator, which is part of an orthogonal feature, F571.) In other SQL implementations various ad-hoc solutions are used, like bit, byte, and character to simulate Boolean values.

See also

  • true and false commands for shell scripting
  • Shannon's expansion
  • Stdbool.h — C99 definitions for boolean

References

  1. ^ Kernighan, Brian W; Ritchie, Dennis M (1978). The C Programming Language (1st ed.). Englewood Cliffs, NJ: Prentice Hall. p. 41. ISBN 0-13-110163-3.
  2. ^ Plauger, PJ; Brodie, Jim (1992) [1989]. ANSI and ISO Standard C Programmer's reference. Microsoft Press. pp. 86–93. ISBN 1-55615-359-7.
  3. ^ "Report on the Algorithmic Language ALGOL 68, Section 10.2.2." (PDF). August 1968. http://www.fh-jena.de/~kleine/history/languages/Algol68-Report.pdf. Retrieved April 2007.
  4. ^ Digital Equipment Corporation, DECSystem10 FORTRN IV Programmers Reference Manual. Reprinted in Mathematical Languages Handbook. Online version accessed 2011-11-16.
  5. ^ "ECMAScript Language Specification". p. 43. http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf.
  6. ^ "The Elements of JavaScript Style". Douglas Crockford. http://javascript.crockford.com/style2.html. Retrieved 5 March 2011.
  7. ^ C. Date (2011). SQL and Relational Theory: How to Write Accurate SQL Code. O'Reilly Media, Inc.. p. 83. ISBN 978-1-4493-1640-2. http://books.google.com/books?id=Ew06OZtjuJEC&pg=PA83.
  8. ^ ISO/IEC 9075-2:2011 §4.5
  9. ^ Martyn Prigmore (2007). Introduction to Databases With Web Applications. Pearson Education Canada. p. 197. ISBN 978-0-321-26359-9. http://books.google.com/books?id=PKggKqIZnN0C&pg=PA197.
  10. ^ Troels Arvin, Survey of BOOLEAN data type implementation
  11. ^ http://www.postgresql.org/docs/current/static/datatype-boolean.html
    Sebelumnya  (Boolean algebra) (Boolean domain)  Berikutnya    





Tags: Boolean data type, Teknik Telekomunikasi, 2243, Boolean data type In computer science the Boolean or logical data type is a data type having two values (usually denoted true and false ) intended to represent the truth values of logic and Boolean algebra, It is named after George Boole who first defined an algebraic system of logic in the mid 19th century, The Boolean data type is the primary result of conditional statements which allow differ, Boolean data type, Bahasa Indonesia, Contoh Instruksi, Tutorial, Referensi, Buku, Petunjuk m.kelas karyawan ftumj, prestasi.web.id
 Kuliah Blended di 112 PTS Terbaik    Waktu Shalat    Download Brosur / Katalog    Cari Karir    Tips & Trik Tes Psikologi    Perkuliahan Gratis    Buku Referensi
Informasi PTS
Khusus Perguruan Tinggi Swasta
Terkemuka & Terakreditasi
STMIKMJ Jakarta
STIE IGI
STTM STIE WP
STEI Jogja
STIE Hidayatullah
STEBI Bina Essa
UMJ: FTan FISIP
Univ. Muhammadiyah Smrg
Univ. Muhammadiyah Sby
UNSUB
STMIK MJ UNKRIS
Univ. Thamrin: FE FASILKOM
ISTA ITBU
STIE Trianandra STIE IGI
STT Mandala Bandung
STMIK STIKOM Bali STTB
POLNAS Denpasar
STT Bina Tunggal Bks.
STIKI Malang
UNDARIS Semarang
INDOCAKTI
UPRI
STIE Hidayatullah Depok
UNISA Dharma Andigha
Universitas Nusantara
UHAMZAH
UTS Makassar
STT Duta Bangsa
STIE GICI IMWI Sukabumi
UNAKI KAHURIPAN
STEI Jogja STIE Pemuda
Universitas Mpu Tantular
USCND Langsa
USM INDONESIA STTM
UNUGHA UM Palangkaraya
STIE WD IKIP WD
STIE Ganesha Yuppentek
STT Muttaqien
STIT BATAM IAI AS
UCM STIE GEMA
Universitas Megou
STIE PIONEER
STIMAIMMI STIEABI
UPGRIS UICM Bandung
AL-AZHAR UNUSA
Tanri Abeng University
STIE AMKOP STIE WP
Univ. Boyolali UDB
UNIBA ITB AD
UNU KALBAR
Ubudiyah
ISIF
STEBI Global Mulia
STT Sapta Taruna
Universitas Bali Dwipa
UNU Kaltim UHS
Univetsitas IVET
CENDEKIA STAI DB
STIE Mitra STiPSi
UNIPI Bandung
STIE Al-Rifa'ie
UNTARA Pelita Bangsa
Patria Artha
Univ. Widya Kartika
UTN Bogor IGN Bogor
Parna Raya
STAI Terpadu Yogyakarta
STIT Al-Hikmah Lampung
Univ. Deli Sumatera
STIA Bayuangga
UI Mandiri
STAI Muhammadiyah Probolinggo
STEBI Bina Essa
STAI Muhammadiyah Tulungagung
Politeknik Harapan Bangsa Surakarta
STIKes Sapta Bakti
ITeKes Tri Tunas Nasional
STEBI Badri Mashduqi
STIA Maulana Yusuf
STAI Miftahul Ulum
STIH Gunung Jati
STIE PPI Balaraja
Poltekkes Kerta Cendekia
ITB Pelita Raya
Poltek Ganesha
Universitas Moch. Sroedji
STIT Al-Hidayah Tasikmalaya
STIT Nur Ahadiyah
Politeknik Aisyiyah
Politeknik Santo Paulus Surakarta
IAI Al-Ghurabaa Jakarta
STAI AL Akbar Surabaya
Universitas Mahakarya Asia Yogyakarta
Politeknik Bhakti Kartini
Univ. Muhammadiyah Smrg
STMIK MJ UNKRIS
Thamrin: FE FASILKOM
STT Bina Tunggal Bks.
STIKI Malang
UNDARIS Semarang
INDOCAKTI
UPRI
STIE Hidayatullah Depok
UNISA Dharma Andigha
Universitas Nusantara
UHAMZAH
UTS Makassar
STT Duta Bangsa
STIE GICI IMWI Sukabumi
UNAKI KAHURIPAN
STEI Jogja STIE Pemuda
Universitas Mpu Tantular
USCND Langsa
USM INDONESIA
UM Palangkaraya
UNUGHA STIE WD IKIP WD
STIE Ganesha Yuppentek
STT Muttaqien
STIT BATAM IAI AS
UCM STIE GEMA
Universitas Megou
STIE PIONEER
STIMAIMMI STIEABI
UPGRIS UICM Bandung
AL-AZHAR UNUSA
Tanri Abeng University
STIE AMKOP STIE WP
Univ. Boyolali UDB
UNIBA ITB AD
UNU KALBAR
Ubudiyah ISIF
STEBI Global Mulia
STT Sapta Taruna
Universitas Bali Dwipa
UNU Kaltim UHS
Univetsitas IVET
CENDEKIA STAI DB
STIE Mitra STiPSi
UNIPI Bandung
STIE Al-Rifa'ie
UNTARA Pelita Bangsa
Patria Artha
Univ. Widya Kartika
UTN Bogor IGN Bogor
Parna Raya
STAI Terpadu Yogyakarta
STIT Al-Hikmah Lampung
Univ. Deli Sumatera
STIA Bayuangga
UI Mandiri
STAI Muhammadiyah Probolinggo
STEBI Bina Essa
STAI Muhammadiyah Tulungagung
Politeknik Harapan Bangsa Surakarta
STIKes Sapta Bakti
ITeKes Tri Tunas Nasional
STEBI Badri Mashduqi
STIA Maulana Yusuf
STAI Miftahul Ulum
STIH Gunung Jati
STIE PPI Balaraja
Poltekkes Kerta Cendekia
ITB Pelita Raya
Poltek Ganesha
Universitas Moch. Sroedji
STIT Al-Hidayah Tasikmalaya
STIT Nur Ahadiyah
Politeknik Aisyiyah
Politeknik Santo Paulus Surakarta
IAI Al-Ghurabaa Jakarta
STAI AL Akbar Surabaya
Universitas Mahakarya Asia Yogyakarta
Politeknik Bhakti Kartini
MM UNKRIS MIKom Fisip UMJ MIA Fisip UMJ
MM STIE Mitra MM UNTARA MM Pelita Bangsa
MM STIE Ganesha
MM STIMAIMMI MM STIEABI
MM STIE IGI MM STIE GICI MKS ITB Ahmad Dahlan
MM IGN MKom IGN
KPT Konsultan Pendidikan Tinggi
Chatting dengan staf
Kuliah Karyawan

(silakan klik di bawah ini)
Penerimaan / Pendaftaran
__Mahasiswa Baru

Lokasi Kampus & Peta
Program Studi (D3, S1, S2)
___(+ Kurikulum & Prospektus)

Pascasarjana (S2)
Biaya Pendidikan
Sistem Pendidikan
Jadwal Kuliah & Dosen
Keunggulan-Keunggulan
Angkutan Umum


GALERI FOTO

Daftar Situs Kuliah Ekstensi
Daftar Situs Kelas Reguler
Daftar Situs Kelas Malam/Sore
Daftar Situs Magister
Jaringan Portal Ensiklopedia
Daftar Situs Ensiklopedi Dunia

Jaringan Situs Forum
Jaringan Situs Iklan
Jaringan Situs Pengumuman
Jaringan Situs Lowongan

Tabel Website Gabungan PTS
Jaringan Portal Gilland Group
Web Iklan Kuliah Pegawai
Tabel Website Barterlink
Konsultan Pendidikan Tinggi
 Program Pascasarjana (S2)    Program Kuliah Non Reguler    Contoh Soal Try Out    Daftar Online    Permintaan Beasiswa Pendidikan    Seluruh Perdebatan    Pusat Ensiklopedis Bebas    Semua Info    Alqur'an Online    Program Perkuliahan Shift    Kuliah Reguler
Kandungan alpha-tocopherol (E) pada berbagai sayuran, Penyemaian biji / benih Kacang Merah, Kandungan gizi 8.790 makanan di dunia, dsb.
Kandungan gizi 8.790 makanan di dunia

Infokan ke Teman
Nama Anda

Email Anda

Email Teman 1
✮ harus diisi dengan benar

Tautan Elok
silakan klik
Bantuan Bencana Gempa
KJRI, KBRI & Kedutaan Lain
Koran di Amerika Serikat
Kuliah Ilmu Internet Link Web Myanmar
Lokasi ATM di Tangerang
Partai Politik di Jamaika
Perguruan Tinggi di Dunia
Perpustakaan Nasional Dunia
Situs COCI Malaysia
Subdomain Gratis

unucirebon.web.id  |  p2k.poliven.ac.id  |  p2k.polteksi.ac.id  |  ubest.web.id  |  p2k.staialakbarsurabaya.ac.id  |  p2k.ucm-si.ac.id  |  p2k.nusamandiri.ac.id  |  uin-al-azhaar.web.id  |  p2k.sebi.ac.id  |  unusida.web.id  |  unmtangerang.web.id