About data types
Variables and constants have data types so the computer knows what is stored in a particular location. Remember it will all be recorded as 1s and 0s so you need to know what data type you are looking at in order to decode data. That is why files have extensions.
Data type |
Description |
Example |
Integer |
For storing whole number values. |
13, 21, 42 |
Real |
Real numbers, also sometimes called floats, are for storing numbers with a decimal part. |
3.14, 7.4 |
Boolean |
A Boolean data type is used when we want to store the state of something as true or false. It can also be used for yes or no. |
true, false |
Character |
An individual character whether it is a letter, digit or symbol. |
"9", "a", "%" |
String |
A group of characters. |
"9D5T", "apple" |