Difference between revisions of "Boolean"

esse quam videri
Jump to: navigation, search
(Example)
Line 1: Line 1:
 
=Definition=
 
=Definition=
 
A variable having two possible values called “true” and “false.” It can be thought of as a binary value.
 
A variable having two possible values called “true” and “false.” It can be thought of as a binary value.
 +
 +
=What does this mean=
 +
Similar to how [[Base 2]] operates, Boolean also can only exist in 2 states, either 0 or 1. But in computer programming, we don't do any calculations with boolean. We simply tell the computer whether an element or condition is true or false.
  
 
=Relevance=
 
=Relevance=
 +
*[[Base 2]]
 
*[[Binary]]
 
*[[Binary]]
 
*[[Bit]]
 
*[[Bit]]
 +
 
=Explanation=
 
=Explanation=
  
Line 31: Line 36:
  
 
=Resources=
 
=Resources=
 +
https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/boolean-data-type
 +
 
== See also ==
 
== See also ==
 
 
* [[Binary]]
 
* [[Binary]]
 
* [[Data Type]]
 
* [[Data Type]]
 
==Notes==
 
 
  
 
==External Links==
 
==External Links==
 
https://en.wikipedia.org/wiki/Data_type
 
https://en.wikipedia.org/wiki/Data_type
 
  
 
[[Category:Programming Language Concepts]]
 
[[Category:Programming Language Concepts]]
 
[[Category:Object Oriented Programming]]
 
[[Category:Object Oriented Programming]]
 
[[Category:C Sharp]]
 
[[Category:C Sharp]]

Revision as of 20:25, 21 June 2019

Definition

A variable having two possible values called “true” and “false.” It can be thought of as a binary value.

What does this mean

Similar to how Base 2 operates, Boolean also can only exist in 2 states, either 0 or 1. But in computer programming, we don't do any calculations with boolean. We simply tell the computer whether an element or condition is true or false.

Relevance

Explanation

A boolean is a data type intended to represent the two truth values of logic and Boolean algebra.

In programming and coding, you can create your own boolean variable and set it to true or false by saying “bool (nameOfYourVariable) = true;”

Boolean variables can be named with words and phrases that relate to a true/false conditional statement, such as “is,” “has,” etc.

Example

Here’s an example related to pizza:

bool tastesGood = true;
bool isCheesy = false;
bool hasTomatoes = true;

Booleans are typically used for conditional statements!

if(tastesGood == true)
{
    bool customerSatisfied = true;
}

Resources

https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/boolean-data-type

See also

External Links

https://en.wikipedia.org/wiki/Data_type