Feb 052018Boolean is a type of data, with only two possible values: true and false.
- In Python, the type
bool
has values True
and False
.
- In Java, the type
boolean
has values true
and false
.
Almost every programming language has Booleans, because they’re necessary for the checks, comparisons and other logical conditions in if/else statements and loops.(1)
Feb 052018Computer programs use variables and data structures to store data in memory.(1)
A data structure is a scheme for representing values of some type in memory; before we can understand, analyse and design data structures, we need to understand memory.
Feb 052018Using multiple bits to represent an integer requires deciding what the bits mean.
A simple scheme for representing numbers could be to represent e.g. the integer value 3 by using three 1s, like so:
Feb 052018Programmers deal with many types of data: most programming languages have integers, booleans, floating point numbers, strings, lists, and more.
The word “type” has a specific meaning: each value has a type.
In Python the value 1
has the type int
, and the value 'Hello, world!'
has the type str
.
In Java the value 1
has the type int
, and the value "Hello, world!"
has the type String
.