Implementation: Data types and structuresStoring text
Data is stored differently depending on its type. Numbers are stored as integers or real numbers, text as string or characters. Lists of the same type of data can be stored in an array.
To store text we use a STRING data type. Think of a word or sentence as just a list (string) of characters. The following are examples of data that could be held using the STRING data type:
Dave
I like the smell of new trainers
34 Bitesize Street, Beebshire
01240 890388
The last example is clearly a phone number. You might expect a phone number to be stored as an integer but this is not the case.
Mobile phone numbers are not stored as integers, as the integer data type holds values that have the potential to be used in calculations. There is no context for using a mobile phone number as part of a calculation, so it is stored as a STRING value.