Skip to content
Programming contents

Programming logic

Stage 1 of Programming14 lessons

The building blocks of any program. From 1.1 to 1.6, in pseudocode, so you can think without fighting a language; from 1.7 to 1.14, in JavaScript, in the browser console, up to a whole game. One idea per lesson, each with its exercise and solution.

  1. Lesson 1.1: What a program is

    A program is a list of instructions. The computer follows them one by one, in order, and guesses nothing.

  2. Lesson 1.2: Algorithms and pseudocode

    Before writing code you need to know which steps to take. That is an algorithm, and pseudocode is how you write it down.

  3. Lesson 1.3: Data and variables

    A program works with data. To use it, it keeps it in variables: boxes with a name.

  4. Lesson 1.4: Deciding: conditions

    A program doesn't always do the same thing. With a condition it chooses what to do based on the data.

  5. Lesson 1.5: Repeating: loops

    If something repeats, you don't write it ten times. You write it once inside a loop.

  6. Lesson 1.6: Functions

    A function is a named piece of a program. You write it once and use it as many times as you need.

  7. Lesson 1.7: From pseudocode to JavaScript

    JavaScript is a real language and it's already in your browser. The ideas are the pseudocode ones; the words change.

  8. Lesson 1.8: Variables and types in JavaScript

    The named boxes from 1.3, now in JavaScript: how to create them, which types exist and a trap worth knowing early.

  9. Lesson 1.9: Conditions and loops in JavaScript

    Deciding and repeating, like in 1.4 and 1.5. In JavaScript what's inside goes between curly braces.

  10. Lesson 1.10: Functions in JavaScript

    The functions from 1.6, written in JavaScript: function to define one and return to give back a result.

  11. Lesson 1.11: Arrays

    An array keeps several values in order, in a single variable.

  12. Lesson 1.12: Objects

    An object groups the data of one thing, each piece with its own name.

  13. Lesson 1.13: Debugging

    A program almost never works the first time. Debugging is finding out why, and there's a method to it.

  14. Lesson 1.14: Project: guess the number

    A whole game with everything from this stage: variables, conditions, loops and functions.