Quick answer
There is no single official list of seven data types. Different textbooks, languages and fields group values in different ways. This guide uses one common grouping for beginners: integers, decimal numbers, characters and text, booleans, null, arrays and lists, and records or objects.
The seven types
- Integers. Whole numbers, positive, negative or zero. Examples:
42,-7. - Decimal numbers. Numbers with a fractional part, often called floating-point numbers. Example:
3.14. A computer stores most of these approximately, not exactly. - Characters and text. A single character or a string of characters. Examples:
'A',"hello". - Booleans. Values that are true or false. Example:
true. - Null or none. A deliberate way to say there is no value. Example:
null. - Arrays and lists. Ordered collections of values. Example:
[90, 85, 77]. - Records, objects and dictionaries. Collections where each item has a name or key. Example:
{name: "Ada", age: 30}.
Which of these are primitive?
The first five are usually treated as primitive types in programming languages, though the exact rules depend on the language. Text is a good example. In JavaScript, strings are primitives. In Java, String is a class, so it is not primitive.
Arrays, lists and records are usually non-primitive, because each one groups several values together. The difference is covered in primitive vs non primitive data types.
Types of data in statistics
Statistics splits data in other ways. One common split is discrete data, which is counted, against continuous data, which is measured on a scale. Discrete data takes specific values, such as the number of students in a class, while continuous data can take any value in a range, such as height. For a definition with more examples, see what is discrete data with examples.
These statistical categories are a separate framework from the programming grouping above, so do not mix them up when you are reading a textbook or a course.
Choosing a grouping
Use the grouping that fits the job. In programming, the most useful split is usually the one the language itself defines. In data analysis, the statistical types help you pick the right chart or test. If you are working with collections of values, see what are the four types of data structure for how those collections are organized.