Data Types and Values
Every piece of information has a kind — let's meet them
- say what a value and a type are,
- name the three main types: number, text, and true/false,
- explain why
"5"(text) is not the same as5(a number).
1. What is a value?
A value is a single piece of information the computer is holding right now. Your game score is a value. Your name is a value. Whether the light is on or off is a value.
Think of a computer's memory as a wall of tiny boxes. Each box can hold one value. When the game says your score is 7, one little box is holding the value 7.
2. The three main types
Values come in different types. When you are starting out, three types matter most:
| Type | What it holds | Examples |
|---|---|---|
| Number | amounts you can count or measure, and do math with | 5, 42, 3.14 |
| Text (also called a string) | letters, words, and symbols written down | "cat", "Hello!", "5" |
| True/False (also called a boolean) | a yes-or-no answer — only two choices | true, false |
Text is often written inside quotation marks like "cat", so the computer knows where the words begin and end.