English:Block-Based Coding

Block-Based Coding
Introduction
Block-based coding is a way to create computer programs by dragging and connecting visual blocks. Each block represents an instruction or a piece of information. Instead of typing every symbol, you can focus on what you want the computer to do and how the instructions fit together. Platforms such as Scratch and editors built with Blockly use this visual approach.
In this aiMOOC, you will learn how to build clear instructions, use repetition and decisions, store information, test your ideas, and improve a program when something goes wrong. You will also create your own small projects. The examples are designed for Grades 5–6, but the same ideas appear in many kinds of computer programming.

Watch this official Scratch Team introduction and notice how blocks snap together to create actions:
Learning goals: By the end of the course, you should be able to explain what an algorithm is, arrange instructions in a useful sequence, use a loop, make choices with a conditional, store changing information in a variable, respond to events, and use debugging to improve a project.
How Block-Based Coding Works
Blocks as Instructions
A block is a visual piece of code. Blocks often have shapes that show where they can connect. A motion block might move a character. A sound block might play a sound. A control block might repeat another group of blocks. When blocks are connected in a stack, the computer follows the instructions in the order the programming environment defines.
This makes programming easier to explore because you can see many possible commands and build with them like puzzle pieces. It does not mean the thinking is simple. You still need to plan, test, make decisions, and solve problems.

Algorithms and Sequences
An algorithm is a clear set of steps for completing a task or solving a problem. In coding, the order of those steps matters. A sequence is a set of instructions arranged in the order they should happen.
Imagine telling a character to walk to a treasure chest. If the character turns before moving, it may head in the correct direction. If you move first and turn later, the character may miss the chest. A useful programmer question is: What should happen first, next, and last?
You can practice algorithms without a computer. Write directions for making a paper airplane, moving through a simple classroom maze, or drawing a shape. Then ask a classmate to follow your instructions exactly. If the result is not what you expected, improve the instructions.
Events: What Starts the Code?
Many block-based projects use event-driven programming. An event is something that happens and causes code to run. Examples include clicking a green flag, pressing a key, touching a sprite, receiving a message, or starting a game.
Events help different parts of a project react to the user or to one another. For example, pressing the space bar might make a character jump, while touching a goal might play a celebration sound.
Loops: Repeat Without Copying
A loop repeats instructions. Loops are useful when the same action needs to happen many times. Instead of placing ten identical movement blocks in a row, you might place one movement block inside a repeat block.
Some loops repeat a fixed number of times. Others continue until a condition becomes true, and some continue for as long as the program runs. Choosing the right loop can make code shorter, clearer, and easier to change.
Try this thinking challenge: A sprite should draw a square. The same move-and-turn pattern happens four times. Which instructions belong inside the loop, and which instruction tells the loop how many times to repeat?
Conditionals: Let the Program Decide
A conditional lets a program choose what to do based on a condition. The basic idea is: if something is true, do an action. Some conditionals also include an else choice for what to do when the condition is false.
A game could use a conditional such as: if the player touches the star, increase the score. An interactive story could use: if the answer is correct, show the next scene; else, give a helpful hint.
Conditionals are powerful because they make a project respond differently in different situations. They are a key part of interactive games, quizzes, simulations, and stories.
Variables: Remember Changing Information
A variable is a named place where a program stores a value that can change. In a game, a variable might store the score, number of lives, time remaining, or current level. In a quiz, it might store the number of correct answers.
A variable has a name so the programmer knows what it represents. Clear names such as score or lives are usually easier to understand than unclear names such as thing1.
This official Scratch Team video shows ways to use variables and lists in Scratch:
Functions and Custom Blocks
As projects grow, programmers often group useful instructions together. A function or custom block can give a name to a group of steps so that the same idea can be used again. For example, a custom block called celebrate might play a sound, change a costume, and show a message.
This is an early form of abstraction: you can use a helpful idea without having to think about every small step each time.
Sprites, Stages, and Interaction
In Scratch, a sprite is a programmable character or object. Sprites can move, change costumes, make sounds, detect other objects, and respond to events. The stage is the area where the project is shown.
You can combine movement, loops, events, conditionals, and variables to build a game. For example, a character can jump when a key is pressed, repeatedly check whether it touches an obstacle, and change a score when it reaches a goal.
Here is an official Scratch Team tutorial that turns several coding ideas into a jumping game:
Debugging and Improving Your Program
Programs do not always work correctly on the first try. Debugging means finding and fixing problems in code. A bug might come from an instruction in the wrong place, a loop that repeats too many times, a condition that never becomes true, or a variable that is changed at the wrong moment.
A strong debugging routine is to test one part at a time. First, describe what you expected. Next, observe what actually happened. Then, inspect the blocks connected to that behavior. Change one thing, test again, and keep notes if the project is complicated.
Errors are useful information. They show you where your idea and the computer's actions are different. Good programmers test often instead of waiting until the whole project is finished.
Plan, Build, Test, Improve
A useful coding cycle is plan, build, test, improve. Start with a small goal. Build the simplest version that works. Test it with different inputs. Then improve the design, instructions, sounds, graphics, or rules.
For a small game, you might first make one character move. Next, add an event that starts the game. Then add an obstacle, a condition that detects a collision, and a score variable. Finally, ask a classmate to play and explain anything that is confusing.
This Code.org video introduces elementary computer science learning with a mix of digital and unplugged activities:
Block Coding and Text Coding
Block-based coding and text-based coding use many of the same ideas: sequences, loops, conditionals, variables, events, and reusable parts. The main difference is how the instructions are written and arranged.
In block coding, the shapes and menus can help you see what fits together. In text coding, you type words and symbols using the rules of a programming language. Learning to think clearly about algorithms and program structure in blocks can prepare you to understand text code later.
Remember that Blockly itself is a library used to build block-based editors; it is not a programming language by itself. Different tools built with blocks can use different commands and rules.
Creative and Responsible Coding
Coding is a creative activity. You can use it to tell stories, make art, model ideas from science, practice mathematics, create quizzes, build games, or control supported physical devices.
When you share a project, protect personal information and follow your teacher's or family's rules for online accounts. Use images, sounds, and code that you are allowed to use. If you remix another person's project, give credit when the platform or license requires it. Be respectful when giving feedback, and focus comments on how the project could become clearer, more interesting, or easier to use.
Interactive Tasks
Quiz: Test Your Knowledge
What is the main purpose of a loop in a program? (To repeat instructions) (!To rename a sprite) (!To draw a backdrop) (!To delete every block)
What is a sequence in coding? (Instructions in the order they run) (!A list of player names) (!A collection of sound files) (!A type of computer screen)
What can start an event-driven script? (A key press) (!A paper notebook) (!A desk lamp) (!A printed worksheet)
Which coding idea lets a program choose an action based on a condition? (A conditional) (!A costume) (!A speaker) (!A backdrop)
What does a variable do? (It stores a value that can change) (!It always stops the program) (!It removes all events) (!It turns every block into text)
What is debugging? (Finding and fixing problems in code) (!Decorating a computer case) (!Typing the same block many times) (!Changing every sprite name)
What is an algorithm? (A clear set of steps for a task) (!A computer monitor) (!A type of background music) (!A drawing tool only)
Why can block shapes be helpful? (They show how code pieces can connect) (!They guarantee every program is correct) (!They remove the need to test) (!They make all projects identical)
Which variable name is clearest for points in a game? (score) (!thing) (!xstuff) (!unknown)
What is a good way to test a project? (Try different inputs and observe results) (!Assume the first version works) (!Change many things before testing) (!Ignore unexpected behavior)
Memory Game
| Sequence | Commands placed in the order they should happen |
| Loop | A structure that repeats instructions |
| Event | Something that happens and starts code |
| Variable | A named place that stores a changing value |
| Conditional | A structure that chooses an action using a true or false test |
| Debugging | The process of finding and fixing problems |
Drag and Drop
| Match the correct terms. | Topic |
|---|---|
| repeat block | Runs code again |
| if block | Makes a decision |
| event block | Starts code after something happens |
| variable block | Stores changing information |
| motion block | Changes a character position |
...
Crossword Puzzle
| Algorithm | What do we call a clear set of steps for solving a problem? |
| Sequence | What do we call instructions placed in the order they run? |
| Variable | What stores a named value that can change? |
| Debugging | What is the process of finding and fixing program mistakes? |
| Sprite | What is a programmable character or object in Scratch? |
| Loop | What structure repeats instructions? |
LearningApps
Cloze Text
Open-Ended Tasks
Easy
- Sequence Challenge: Write six simple instructions for moving a classroom object from one safe place to another, then ask a partner to follow the sequence exactly and improve any unclear step.
- Loop Art: Use a block-based editor to create a repeating movement or drawing pattern, then explain which instructions are inside the loop and why.
- Debugging Detective: Take a small block program that does not behave as expected, identify one likely bug, test one change, and record what happened.
- Coding Storyboard: Draw a four-panel storyboard for a short animation and label the event, movement, sound, or message that should happen in each scene.
Standard
- Interactive Story Project: Build a short interactive story with at least two sprites, one event, one loop, and one conditional, then ask a classmate to test the choices.
- Game Score System: Create a simple game in which a variable stores the score, explain exactly when the score changes, and test whether it works after restarting the game.
- Class Coding Interview: Interview a classmate, teacher, family member, or local technology worker about how they solve problems with digital tools, then summarize two ideas that connect to algorithms or debugging.
- Unplugged Algorithm Test: Design a paper-based maze or movement challenge, write an algorithm for solving it, let two people test the instructions, and revise the algorithm using their feedback.
Advanced
- Maze Game Design: Build a maze or obstacle game that combines events, loops, conditionals, and at least one variable, then create a short test plan for unusual player actions.
- Block-to-Text Comparison: Choose a small block program and rewrite its logic as clear pseudocode or beginner-friendly text code, then compare what is easy to see in each version.
- Coding Tutorial Video: Record a short tutorial video that teaches one coding concept such as loops, events, variables, or debugging, using your own example and a clear explanation.
- Coding Exhibition: Visit a school makerspace, computer lab, robotics club, or digital exhibition with teacher or family permission, observe one coded system, and create a poster or slide explaining how sequences, decisions, repetition, or stored data might be involved.
Learning Assessment
- Algorithm Reasoning: Explain why changing the order of two instructions can change a program's result, and give a block-coding example.
- Loop Application: Redesign a repeated sequence so that it uses a loop, then explain how the change improves the program.
- Conditional Transfer: Create a real-life if-then rule and show how the same reasoning could control a choice in a game or interactive story.
- Variable Analysis: Describe a project that needs a variable, state what value it stores, and explain when that value should change.
- Debugging Evidence: Present a bug you found, the test you performed, the change you made, and evidence that the new version works better.
- Project Reflection: Show a finished block-based project and explain how at least three programming concepts work together to create the final behavior.
Evidence of Learning
- Knowledge: You can explain algorithms, sequences, events, loops, conditionals, variables, sprites, and debugging using your own examples.
- Skills: You can plan a small program, connect blocks in a sensible structure, test different inputs, trace what happens, and improve faulty code.
- Products: You can produce a working animation, story, game, drawing, quiz, or similar block-based project that uses several coding concepts.
- Communication: You can describe how your program works, give useful feedback on another project, and document at least one change made after testing.
- Transfer: You can recognize the same ideas in another block-based tool, in pseudocode, in beginner text code, or in a real-world step-by-step process.
OERs on the Topic
The following free resources can help you continue learning with examples, tutorials, and creative projects:
- Scratch Foundation Learning Library: Activities, coding cards, videos, and project ideas for learning with Scratch.
- Scratch Ideas: Beginner-friendly Scratch tutorials and project starters.
- Blockly Docs: Explanations of visual blocks and the Blockly library used to build block-based editors.
- Code.org Elementary Learning: Free coding activities and courses for young learners.
Linked Learning Areas
Block-based coding connects computer science with mathematics, English, art, design, science, and problem solving. A game can use coordinates and variables from mathematics. An interactive story uses planning, dialogue, and audience awareness from English. Digital art uses patterns, repetition, and geometry. A science model can use rules and variables to represent change. Across all of these areas, you practice computational thinking by breaking a problem into smaller parts, noticing patterns, designing steps, testing results, and improving your solution.
aiMOOC Projects
LernweltNOAH fragen