Different Kinds of Information

Words, numbers, and yes/no values — computers treat different types of data differently.

6 min read

The boxes (variables) you just met can hold different kinds of things. Just like in real life you'd treat a jar of coins differently from a stack of letters, a computer treats different kinds of information differently.

Three friendly types to start with

You'll meet many types eventually, but here are the three most common, in plain terms:

  • Text — words and sentences, like a name or a message. Programmers often call this a string (think of letters strung together like beads). We usually wrap text in quotes: "Hello".
  • Numbers — like 7, 100, or 3.5. No quotes needed. You can do math with these.
  • True/False — a yes-or-no value, like "is the door locked?" Programmers call this a boolean. It can only be true or false.

Why the difference matters

The type changes what you can do. Look closely at these two lines:

5 + 3
"5" + "3"

The first uses numbers, so the computer does math: the result is 8.

The second uses text (note the quotes!), so the computer sticks the characters together: the result is "53". Same-looking symbols, completely different meaning — all because of the type.

Tip: Quotes are the giveaway. 42 is a number you can do math with. "42" is text that just happens to look like a number. This small detail trips up almost every beginner at least once — now you're ahead of the game.

You don't need to memorize this

You won't be tested on a long list of types. For now, just remember the big idea: information comes in different types, and the type affects what the computer can do with it. That awareness alone will save you headaches later.

Quick check

Q1 What do programmers usually call a piece of text, like a name or message?

Q2 Why might "5" + "3" give a different result than 5 + 3?

Want to save your progress? It's free.

Create a free account