Bitpath

Lesson 1 · Unit 01

Values and expressions

Numbers, text, and the order a calculation happens in

13 exercisesabout 3 min

What you practise

  • Numbers and text, console.log, arithmetic and its order, % and **, strings in quotes, one statement at a time

Try a question from this lesson

Pick one

This is a whole program: one instruction. What do you think appears on the screen when it runs?

TypeScript
console.log(2 + 3);

The ideas

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

Statements

A program is a list of instructions. Each one is called a statement and ends with a semicolon.

The computer runs statements from top to bottom, one at a time. Nothing is skipped and nothing runs twice, unless you say so.

Each console.log prints on a new line. Printed text is called the program's output.

TypeScript
console.log(1);
console.log(2);
console.log(1 + 2);

Concept

Operators and brackets

The four basic operators are +, -, * (multiply) and / (divide). Dividing can give a decimal: 7 / 2 is 3.5.

* and / happen before + and -. To change the order, use round brackets: whatever is inside them is worked out first.

Text after // is a comment: a note for people. The computer ignores it.

TypeScript
console.log((2 + 3) * 4); // 20
console.log(7 / 2);       // 3.5

Concept

Text is a string

Text goes inside double quotes. A piece of text is called a string: a string of characters.

Nothing inside the quotes is calculated. "2 + 3" is just five characters. The quotes mark where the text starts and ends, and they are not printed.

+ between two strings joins them end to end. Spaces count: if you want one, put it inside the quotes.

TypeScript
console.log("Hello");
console.log("2 + 3");
console.log("Hi " + "Ada");

9 more exercises in the app

  • 4× multiple choice
  • 3× type the answer
  • 1× fill the blanks
  • 1× true or false

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy