---
title: "Text or number?"
subtitle: "Starting out · Numbers and switches · Lesson 2"
---

# Text or number?

**Name:** {{field-24}} **Date:** {{field-15}} **Class:** {{field-15}}

> **Key question:** 12 and 3 make 15. But a computer can also turn 12 and 3 into 123. How does it know which to do?


:::teacher-note

**In one sentence:** Students see that 12 typed as text is two characters with their own codes, compare adding numbers with joining text, and choose number or text for each box on a sign-up form (AC9TDI6K03 node 2).

**Students should be able to say:** I can say what a computer does with numbers and with text. I can explain why 12 and 3 can make 15 or 123. I can choose whether a form should store something as a number or as text.

**Width:** the unmarked parts are the floor every student does (predict, run, investigate and make). Typical adds the modify practice; wider adds the real-world contexts. They add contexts, not difficulty. Students work in the online tutorial alongside this sheet.

:::


## Predict


:::keep-together

**A form has two text boxes. Ana types 12 in one and 3 in the other. The form joins the two pieces of text together. What does it show?**

☐ 4

☐ 15

☐ 123

☐ 12 3

My prediction, and why:

{{lines-3}}

:::


:::teacher-note

**What happens:** 123. Joining text puts one piece after the other. Only numbers get added.

:::


## Run

Try it on the board in the tutorial. Was your prediction right? What was different?

{{lines-2}}

## Worked example: same keys, different jobs


:::keep-together

### 12 and 3, two ways

1. $12 + 3 = 15$ — Stored as numbers: the computer adds them.
2. $\text{12 joined to 3} = \text{123}$ — Stored as text: the computer puts one after the other.
3. $\text{"12"} \to 49,\ 50$ — As text, 12 is two characters, each with its own code.
4. $\text{the type decides}$ — Number or text: the computer stores which one it is, and that decides what it can do.

Now: which can be added?

**Which can the computer add up to make a total?**

☐ 12 stored as a number

☐ 12 stored as text

☐ Both

☐ Neither

:::


:::teacher-note

**Answer:** 12 stored as a number

Numbers can be added, taken away and sorted by size. Text can be joined and sorted A to Z.

:::


:::keep-together

### Find the mistake

**Sam joins two text boxes. Click the line where it first goes wrong.**

```
 1  Sam types 12 in one text box and 3 in another, then joins them.
 2  Inside the computer, text is stored as numbers.
 3  So the computer adds them up: 12 + 3.
 4  The answer box shows 15.
```

Line: {{field-15}}

Why is it wrong?

{{lines-2}}

:::


:::teacher-note

**Answer:** line 3

Line 3: text is stored as codes, but the computer doesn't add text. It joins it, so the box shows 123.

:::


:::keep-together

### Phone numbers

**Why is a phone number like 0412 345 678 stored as text?**

☐ Text is faster

☐ It isn't: it's a number

☐ You never add them, and the 0 at the front must stay

☐ Phone numbers are too big to be numbers

:::


:::teacher-note

**Answer:** You never add them, and the 0 at the front must stay

As a number, 0412 would lose its 0 and become 412. As text, every character stays.

:::


:::typical

## Vary: what happens?


**Add.** 

**Join.** 

**Join words.** 

Work in the tutorial. Plan first: what will you change, and how will you test it?

{{box-4}}

:::


## Which type?


:::keep-together

### Score

**A game keeps your score and adds 10 every time you win. How should it store the score?**

☐ As a letter

☐ As text

☐ As a number

☐ Either works the same

:::


:::teacher-note

**Answer:** As a number

The game does maths with it, so it's a number.

:::


:::keep-together

### Names

**A class list sorts names from A to Z. What type are the names?**

☐ Numbers

☐ Text

☐ Both

☐ Neither

:::


:::teacher-note

**Answer:** Text

Names are text: sorted A to Z by their letter codes, never added.

:::


:::keep-together

### Review: codes

**Review: A is 65. What number is the letter F?**

Answer: {{field-15}}

:::


:::teacher-note

**Answer:** 70

Count on five from 65.

:::


## Make: design a sign-up form

Then: think of a box on a real form. Would a number or text be safer?

Work in the tutorial. Plan first: what will you change, and how will you test it?

{{box-4}}

## Exit ticket

:::keep-together

**A and B are 5 and 6. As numbers, what do they make together? As text?**

{{lines-3}}

:::


:::teacher-note

**Answer:** 11 (added); 56 (joined).

:::

