Introduction to coding
Coding means giving a computer instructions in a language it understands. Computers are very fast but they only do exactly what they are told — nothing more, nothing less.
Each lesson has a short explanation, something to try away from the screen, and a game challenge to practise.
Coding means giving a computer instructions in a language it understands. Computers are very fast but they only do exactly what they are told — nothing more, nothing less.
Instructions run in order, one after the other. This is called a sequence. If you swap two instructions, the result changes.
A variable is a named box that stores a value, like score = 10 or speed = 3. When the value changes, everything that uses it changes too.
A condition is a question with a yes/no answer. IF it is raining THEN take an umbrella ELSE wear a hat. Programs use conditions to make decisions.
A loop repeats instructions. Instead of writing “step” ten times, you write “repeat 10 times: step”. Loops make programs shorter and easier to change.
A function is a named group of instructions you can use again and again. Define it once (“brushTeeth”) and call it whenever you need it.
Programmers break big problems into small steps, look for patterns, and test their ideas. This is called computational thinking.
A bug is a mistake in a program. Debugging means running the program, watching carefully where it goes wrong, and fixing that exact step. Every programmer debugs every day!
Games are built from rules triggered by events: WHEN a key is pressed THEN move; WHEN the player touches a coin THEN add a point. Designers mix simple rules to make fun challenges.
Artificial intelligence lets computers learn patterns from examples instead of being given every rule. The examples (data) matter: if they are one-sided, the AI learns the wrong thing. AI can be wrong, so people should always check its answers.