Mathematics I / Variables, Types, and Expressions
Practice question · Sort into groups

The symbol + adds numbers but joins text. Sort each expression by what + actually does.

Groups: Adds numbers · Joins text

Hints
  1. The operands' TYPE decides the operation, not the symbol.
  2. Quoted digits are still text.
Show the answer

Adds numbers: 3 + 4, 1.5 + 2

Joins text: the quoted text 3 plus the quoted text 4, the quoted word cat plus the quoted word fish, the quoted phrase total: plus the quoted text 7

Why

The numeric cases give 7 and 3.5; the quoted cases give 34, catfish and total: 7. The same symbol means two different operations, which is why knowing a value's type is not optional.

Read the lesson: Variables, Types, and Expressions →

Practise Variables, Types, and Expressions

The app has 4 more questions on this lesson, and keeps your place in the course. Mathematics I is free to start.

More questions on Variables, Types, and Expressions