Level 1 — The basics
Basic Data Types
Original notes by SunDiaL · View English source
Basic data types are provided out of the box and are the building blocks for everything else. They are:
The boolean
The boolean is a type used to represent true and false.
May be treated as a number, with 1 being true and 0 being false.
For operations, see logical operations.
The math involving booleans is called boolean algebra.
The numbers
Love 'em, hate 'em, you need 'em. Numbers are broken down into:
- signed integers = natural numbers
- unsigned integers = integer numbers
- floating point = rational and irrational numbers
| Signed integers | Unsigned integers | Floating point | |
|---|---|---|---|
| 8 bit | sbyte | byte | |
| 16 bit | short | ushort | half |
| 32 bit | int | uint | float |
| 64 bit | long | ulong | double |
| 128 bit | decimal | ||
| For operations, see arithmetic operations. |
The math involving numbers is called Algebra.
The char
A char is a letter. Specifically it represents a character from the ASCII table. A char may be treated as a byte.
The string
If a char is one character, a string is many characters (AKA text). The string is a basic data type only because it is provided out of the box by every programming language. The string is actually a class. Specifically, it is an immutable collection of chars.
Collections
Collections are a basic data type only because they are provided out of the box by every programming language. Collections are actually generic classes used to hold many objects of the same type.