Learn to Code
All tracks
Learn to Code

Free lessons from scratch to pro — every language, databases and DevOps.

AboutContactPrivacy PolicyTerms of Use

Your progress is saved in this browser. © 2026 Learn to Code

PB
Programming Basics
0/10 completed
Beginner
How computers workWhat is a program?Thinking in algorithmsData, variables and types
Intermediate
Decisions and loopsBreaking problems into functionsErrors and debugging
Advanced
Reading documentation and learning on your ownClean code basics
Pro
Thinking like a software engineer
Tracks / Programming Basics / Beginner

What is a program?

A program is a list of precise instructions that a computer follows in order. That's it. Apps, games, websites and AI models are all programs: some have ten lines, some have millions.

Computers are fast but literal

A computer does exactly what you say, never what you meant. Imagine instructing a robot to make tea:

"Make tea." → ❌ The robot doesn't know what "make" or "tea" means.

You need to break it down into steps:

  1. Fill the kettle with water.
  2. Switch the kettle on.
  3. Wait until the water boils.
  4. Put a tea bag in a cup.
  5. Pour the boiling water into the cup.
  6. Wait 3 minutes.
  7. Remove the tea bag.

Even this skips details: where is the kettle? What if there's no tea bag? Programming is the skill of breaking problems down until each step is simple and unambiguous.

Your first programs in two languages

The same idea in JavaScript and in Python. Press Run on both:

JavaScript · editable
Python · editable

The first time you run Python, your browser downloads the Python interpreter (about 10 MB). After that it's cached and fast.

Different syntax (spelling and punctuation), same concepts. Once you understand the concepts, picking up a new language is much easier.

Input → Process → Output

Most programs follow this shape:

Python · editable

Change quantity to 1 and run it again. The output changes because the program makes a decision.

How code becomes action

  You write          A tool translates         The CPU runs
┌────────────┐      ┌──────────────────┐      ┌──────────────┐
│ source code│ ───▶ │ compiler or      │ ───▶ │ machine code │
│ (text)     │      │ interpreter      │      │ (numbers)    │
└────────────┘      └──────────────────┘      └──────────────┘
  • Source code is just text. You can write it in any editor, and VS Code is the most popular.
  • A compiler translates the whole program ahead of time into a file you can run (C, Go, Rust).
  • An interpreter reads and runs your code on the fly (Python, and JavaScript in the browser, though modern engines JIT-compile it for speed).

Syntax errors: the computer is strict

One missing bracket and the program won't run. Try it:

JavaScript · editable
Python · editable

Fix them by adding the missing ). Reading error messages is a core programming skill. There's a whole lesson on it later.

Which language should I learn?

Goal Good first language
Websites and web apps JavaScript (it's the only language that runs natively in browsers)
Data, automation, AI, general purpose Python (readable and very popular)
Android apps Kotlin
iPhone apps Swift
Games C# (Unity) or C++
Systems, high performance Go, Rust, C++

The concepts transfer. Variables, conditions, loops and functions exist in every language. This track teaches them in both JavaScript and Python.

Practice

Write a program (in either language) that stores your birth year, calculates your age this year, and prints a sentence like "I am 25 years old."

Python · editable
✎ Check your understanding

1.What is a program?

2.What does an interpreter do?

← How computers work