Antonio D'souza

Types of data

Data is often used to represent concepts, objects & systems in the real world. Computers represent everything (i.e. both data and instructions) as sequences of bits (short for binary digit), whose values (like a toggle switch) can be either on or off; we use off to represent 0 and on to represent 1. We can group these bits into larger and more complex structures to represent anything else.

The easiest things to represent are dichotomies (e.g. true/false, yes/no, up/down, north/south, etc.) because it takes only a single bit to represent them. We call these booleans (in honour of George Boole, a British Mathematician & Philosopher).

Here are examples of creating a boolean value in different (programming) languages:

C

  #include <stdbool.h>

  bool isAlive = true;

Python

  from typing import bool

  is_alive: bool = True

Java

  boolean isAlive = true;

TypeScript

  let isAlive: boolean = true;

Next up are numbers.