Skip to content

Introduction to Programming

Programming is the practice of giving precise instructions to a computer. You learn it by writing small programs, seeing what they do, and correcting the difference between what you expected and what happened.

Variables and data

A variable is a named place to keep a value. Giving values meaningful names makes a program readable even when you return to it weeks later.

Different kinds of data behave differently. Text, whole numbers, and lists each support useful operations, and mixing them without care is a common source of bugs.

Conditions and loops

A condition lets a program choose between paths. Think of it as a question the program asks each time it reaches that point.

A loop repeats work without repeating code. Use it when the same operation must happen to every item in a list, and make sure the loop can finish.

Build, run, check

Write the smallest piece that does something visible, run it, and check the result. Small steps make errors easy to locate.

When something fails, read the error message from the top. The first line usually names the real problem; later lines are often consequences.

Core building blocks

Concept What it does Simple example
Variable Stores a named value score = 10
Condition Chooses a path if score > 5
Loop Repeats a step for each item