Computers & Coding

Algorithms, arrow codes, loops, events and keeping your information private

Skills

  • Algorithms in everyday life
  • Arrow sequences — forward and turn
  • Loops
  • Events — when this happens, do that
  • Debugging step by step
  • Inputs and outputs
  • Keyboard basics
  • Personal information and your digital footprint

Lessons

Algorithms in everyday life

An algorithm is a list of steps to solve a problem or finish a task. Computers follow algorithms, and so do you, every single day! Examples: 🍋 Lemonade → squeeze lemons, add water, stir, taste; 🎒 Getting ready for school → get dressed, eat breakfast, brush teeth, pack your bag; 🎲 The rules of a board game are an algorithm. Tip: Write steps for making your bed, then have someone follow them exactly!

Arrow sequences — forward and turn

Arrow codes tell a robot what to do. ⬆️ means move forward one square, ↪️ means turn right, and ↩️ means turn left. A turn spins the robot in place without moving to a new square. Examples: ⬆️ ⬆️ ↪️ ⬆️ → forward 2, turn right, forward 1; 🤖 Play 'robot': a friend follows your arrows to reach a toy; 🧀 Draw a grid on paper and write arrows to lead a mouse to the cheese. Tip: Before picking left or right, face the same way the robot is facing!

Loops

A loop repeats a set of steps a certain number of times. Loops make code shorter and easier to read. Examples: ⬆️↪️ ⬆️↪️ ⬆️↪️ ⬆️↪️ → Repeat 4 times: forward, turn right = a square path; 🐸 In ScratchJr, a Repeat block makes a character hop again and again; 🪥 Brushing teeth → repeat 'brush up and down' many times. Tip: Spot steps that repeat and wrap them in a loop!

Events — when this happens, do that

An event is something that happens, like a tap, a click or a key press. Code can wait for an event and then run: when this happens, do that. Examples: 🔔 When the school bell rings → line up; 🐱 In ScratchJr, when you tap the cat → it jumps; 🟢 When the green flag is tapped → the story starts. Tip: Play a game: 'When I clap, you jump!' — that's an event!

Debugging step by step

When code doesn't work, test it one step at a time. Find the exact step where it goes wrong, fix it, and run it again to check. Examples: 🤖 The robot should reach the ⭐ but bumps a wall at step 3 → change step 3; 👉 Move your finger on the grid while reading each arrow out loud; 🔁 Fixed one bug? Run it again — there might be another!. Tip: Bugs are normal — every coder debugs!

Inputs and outputs

An input is information you put into a computer. An output is what the computer gives back. The computer takes the input, works on it, and makes an output. Examples: ⌨️ Input: typing a letter → 🖥️ Output: the letter shows on the screen; 👆 Input: tapping play → 🔊 Output: music comes out of the speaker; 🎤 Input: microphone, mouse, touchscreen; Output: screen, speaker, printer. Tip: Ask yourself: am I giving the computer something, or is it giving me something?

Keyboard basics

A keyboard has keys for letters, numbers and special jobs. The space bar makes a space, Shift makes a capital letter, Backspace erases, and Enter (or Return) starts a new line. Examples: Space bar → puts a space between words; Shift + a → A (a capital letter); Home row → A S D F for the left hand, J K L ; for the right hand. Tip: Feel the little bumps on F and J — they help your fingers find home!

Personal information and your digital footprint

Personal information is facts about you, like your full name, address, phone number, school, birthday and passwords. Keep it private online. Your digital footprint is the trail of what you post and do online, and it can stay there for a very long time. Examples: 🎮 A game asks for your address → stop and ask a grown-up; 🙂 Online, use a nickname instead of your real name, with a grown-up's OK; 📸 Before posting a picture → ask a grown-up and think, 'Would I be OK if everyone saw this?'. Tip: Think before you click, and ask a grown-up first!

For parents