Skip to main content
CodeSpeedTest
Languages
Start TypingJump into a test — pick any languageAdaptive TrainingUnlock chars as you master themPractice DrillsFocused sessions targeting weak spotsDaily ChallengesNew coding challenges every dayRace ModeCompete against others in real timeAI OpponentRace against an AI at your WPM levelTournamentsLive coding speed tournamentsArcade GamesZType, Overkill Survival, Glyphica & moreGamificationXP, coins, badges & quests
LeaderboardGlobal rankings for every languageCertificatesEarn verifiable Bronze / Silver / Gold certsActivityDaily streaks & historical analyticsProfileYour stats, badges & achievements
Browse Languages500+ languages with real code examplesBlogTips, guides & deep divesFree ToolsWPM calculator, typing speed report & moreFAQCommon questions answeredGetting StartedNew to CodeSpeedTest?AboutOur story & missionSupportGet help — Pro users get priorityContactGet in touch with the team
Pricing
  1. Home
  2. /
  3. Learn
  4. /
  5. Scratch

Learn Scratch - 10 Code Examples & CST Typing Practice Test

Scratch is a visual block-based programming language developed by MIT, designed to teach programming concepts through drag-and-drop code blocks, animations, and interactive stories. It is widely used in education for beginners and young learners.

View all 10 Scratch code examples →
Simple Scratch ProjectScratch - Hello WorldScratch - Bouncing SpriteScratch - Simple CounterScratch - Play SoundScratch - Follow MouseScratch - Jump MechanicScratch - TimerScratch - Score SystemScratch - Sprite Animation

Learn SCRATCH with Real Code Examples

Updated Nov 25, 2025

Explain

Scratch uses visual blocks instead of written code.

Users combine blocks to build logic, animations, and games.

Ideal for beginners with no programming background.

Browser-based environment with a strong community.

Supports sprites, events, loops, variables, and sounds.

Core Features

Motion, Looks, Sound, Events, Control blocks

Variables and lists

Broadcasting messages

Cloning sprites

Extensions like music, video sensing, and micro:bit

Basic Concepts Overview

Blocks instead of text code

Sprites representing characters

Stage representing background

Events trigger behavior

Loops and conditions control logic

Project Structure

Sprites/ - characters with behaviors

Scripts/ - blocks attached to sprites

Costumes/ - sprite visuals

Sounds/ - audio assets

Stage/ - background and global events

Building Workflow

Select or create sprites

Drag blocks into the scripting area

Combine blocks into scripts

Test and adjust behavior

Share or download project

Difficulty Use Cases

Beginner: simple animations

Intermediate: platformer games

Advanced: variable-driven systems

Expert: complex logic with clones

Educational: teaching loops and conditions

Comparisons

Scratch vs Python: Scratch is visual; Python is text-based and scalable.

Scratch vs Blockly: Blockly is generic; Scratch is game/animation-focused.

Scratch vs Roblox Lua: Lua is used for professional game scripting.

Scratch vs MIT App Inventor: Scratch teaches basics; App Inventor builds apps.

Scratch vs Tynker: Scratch is free/open; Tynker is commercial.

Versioning Timeline

2003 - Scratch early prototype

2007 - Scratch 1.0 release

2013 - Scratch 2.0 (Flash version)

2019 - Scratch 3.0 (HTML5 version)

Ongoing - Extensions and educational growth

Glossary

Sprite: a character or object

Stage: background area

Block: visual code piece

Broadcast: message triggering scripts

Clone: duplicate of a sprite

Installation Setup

Use Scratch directly in the browser

Optional: install Scratch Desktop

Create a Scratch account for saving projects online

Open the editor to begin using sprites and blocks

Start with built-in tutorials

Environment Setup

Open Scratch editor

Select sprites and blocks

Use tutorials if needed

Save online or offline

Share with community

Config Files

sb3 project file

Project.json (internal)

Assets stored in zip structure

Optional cloud variable settings

Extensions imported automatically

Cli Commands

No traditional CLI

Use TurboWarp CLI tools

Export project

Compile to HTML

Install Desktop app

Internationalization

Scratch available in 70+ languages

Community translations

Unicode text support

Localized tutorials

Global user base

Accessibility

Works in browser

Multilingual interface

Accessible tutorials

Keyboard-friendly options

Designed for kids of all ages

Ui Styling

Color-coded block categories

Drag-and-drop editor

Timeline-like costumes

Sprite thumbnails

Clean kid-friendly UI

State Management

Variables store numbers/text

Lists store sequences

Clones inherit parent script

Broadcast messages trigger state changes

Global vs local variables

Data Management

Local variables

Cloud variables (online only)

Lists for collections

No external database

Memory reset on green flag

Architecture

Block-based visual programming

Event-driven execution

Sprite and stage model

Frame-based animation engine

Browser-based virtual machine running blocks

Rendering Model

Frame-based animation

Scratch VM executes blocks

Events trigger script chains

Sprites render independently

Blocks translate to JavaScript internally

Architectural Patterns

Event-driven model

Block composition

Sprite-based components

Parallel scripts

Message broadcasting

Real World Architectures

Educational coding classrooms

STEM competitions

Interactive storytelling projects

Beginner robotics

Prototyping logic visually

Design Principles

Low floor, high ceiling, wide walls

Accessible to beginners

Playful learning

Creative expression

Collaborative community

Scalability Guide

Keep sprite count low

Avoid excessive clones

Keep loops optimized

Reduce costume sizes

Limit real-time heavy logic

Migration Guide

Move from Scratch to Python using logical structures

Translate blocks to text code concepts

Use Scratch to design algorithms first

Upgrade complex logic to text languages

Keep assets and logic documented

Performance Notes

Runs in a browser VM

Excessive clones may slow execution

High-resolution costumes reduce performance

Loops with heavy logic may lag

Optimized for education, not speed

Security Notes

Runs in a sandboxed environment

No file system access

No network access from scripts

Safe moderated community

Requires account for sharing

Monitoring Analytics

Sprite position tracking

Variable displays

Broadcast message flow

Script performance in editor

TurboWarp profiling

Code Quality

Organize scripts by function

Use comments

Split logic using broadcasts

Keep variable names clear

Avoid overlapping scripts

Practical Examples

Make a sprite move by pressing arrow keys

Play sound on click

Build a simple chase game

Animate a conversation

Score-keeping mini-games

Troubleshooting

Check if the right sprite is selected

Verify event blocks are present

Ensure variable values update correctly

Check clone limits

Look for overlapping broadcast messages

Testing Guide

Run scripts directly from the editor

Use green flag to test entire project

Debug variable changes

Check event triggers

Test clone behavior

Deployment Options

Publish to Scratch website

Export project as .sb3 file

Run locally via Desktop

Use TurboWarp to embed on websites

Package as HTML using converters

Tools Ecosystem

Scratch Online Editor

Scratch Desktop

TurboWarp (faster runtime)

PenguinMod variants

Educational classroom tools

Integrations

Micro:bit

LEGO Mindstorms

Makey Makey

Webcam/video sensing

Extensions for music and pen drawing

Productivity Tips

Use comments and labels

Break code into events

Use broadcasts to organize

Optimize clone usage

Keep assets lightweight

Challenges

Managing many sprites

Complex clone interactions

Avoiding spaghetti-scripts

Performance drops with heavy logic

Limited data structures

Learning Path

Learn basic motion and looks

Use events to trigger behavior

Start loops and conditions

Create variables and lists

Build a full game or story

Skill Improvement Plan

Week 1: Learn sprite and stage basics

Week 2: Animations and movement

Week 3: Variables and scoring

Week 4: Game design logic

Week 5: Advanced cloning and messages

Interview Questions

What is Scratch and who created it?

Explain how event-driven logic works in Scratch.

How does Scratch teach computational thinking?

What are sprites and how do they interact?

Compare Scratch with another beginner language.

Cheat Sheet

Green flag: start program

Motion blocks: move sprites

Control blocks: loops, if, wait

Events: triggers like key press

Variables: store numbers/text

Books

Super Scratch Programming Adventure!

Coding Projects in Scratch

Scratch for Kids

Creative Coding with Scratch

Game Design for Beginners

Tutorials

Basic movement

Making animations

Building games

Working with variables

Advanced clone techniques

Official Docs

https://scratch.mit.edu

https://en.scratch-wiki.info/wiki/Scratch

Community Links

Scratch Forums

Scratch Wiki

YouTube Scratch educators

MIT Scratch resources

Global Scratch communities

Community Support

Scratch Community Forums

MIT Scratch Team resources

YouTube tutorials

STEM educator networks

Coding clubs worldwide

Monetization

Educational curriculum sales

Workshops and classes

Books and teaching materials

No ads or paid plans

STEM program funding

Future Roadmap

More extensions

Improved performance

Mobile-friendly editing

AI-driven tutorials

Expanded classroom features

When Not To Use

Building production apps

Large-scale simulations

High-performance games

3D environments

Advanced algorithmic projects

Final Summary

Scratch is a beginner-friendly visual programming environment.

Great for education, animations, and simple games.

Uses blocks instead of code, encouraging creativity.

Not intended for professional software.

Has one of the world’s largest coding communities.

Faq

Is Scratch free?

Yes - totally free and open for everyone.

Can Scratch make real apps?

No, Scratch is for learning, not production software.

Is Scratch safe for kids?

Yes - it has moderation and child-friendly design.

Can Scratch control hardware?

Yes - with extensions like micro:bit and LEGO.

Can Scratch run offline?

Yes - using Scratch Desktop.

Code Sample Descriptions

1

Simple Scratch Project

when green flag clicked
forever
    if <key [right arrow] pressed?> then
        change x by 10
    end
    if <key [left arrow] pressed?> then
        change x by -10
    end
end

A simple Scratch project where a sprite moves across the screen and responds to arrow keys.

Let’s Try →
2

Scratch - Hello World

when green flag clicked
say [Hello World!] for 2 seconds

Displays 'Hello World' when the green flag is clicked.

Let’s Try →
3

Scratch - Bouncing Sprite

when green flag clicked
point in direction (45)
forever
    move 10 steps
    if on edge, bounce
end

A sprite moves and bounces around the edges.

Let’s Try →
4

Scratch - Simple Counter

when green flag clicked
set [count v] to 0
forever
    if <key [space] pressed?> then
        change [count v] by 1
    end
end

A variable counter increases when space is pressed.

Let’s Try →
5

Scratch - Play Sound

when green flag clicked
play sound [meow v]

Plays a sound when the green flag is clicked.

Let’s Try →
6

Scratch - Follow Mouse

when green flag clicked
forever
    point towards [mouse-pointer v]
    move 5 steps
end

A sprite follows the mouse pointer.

Let’s Try →
7

Scratch - Jump Mechanic

when green flag clicked
set [yvel v] to 0
forever
    change y by (yvel)
    change [yvel v] by -1
    if <key [space] pressed?> then
        set [yvel v] to 12
    end
end

A simple jump using gravity simulation.

Let’s Try →
8

Scratch - Timer

when green flag clicked
reset timer
forever
    say (timer)
end

Displays how long the project has been running.

Let’s Try →
9

Scratch - Score System

when green flag clicked
set [score v] to 0
forever
    if <touching [apple v]?> then
        change [score v] by 1
    end
end

Basic score system that increases when touching another sprite.

Let’s Try →
10

Scratch - Sprite Animation

when green flag clicked
forever
    next costume
    wait 0.1 seconds
end

Switches costumes rapidly to simulate animation.

Let’s Try →

Frequently Asked Questions about Scratch

What is Scratch?

Scratch is a visual block-based programming language developed by MIT, designed to teach programming concepts through drag-and-drop code blocks, animations, and interactive stories. It is widely used in education for beginners and young learners.

What are the primary use cases for Scratch?

Teaching coding concepts to kids. Creating animations and stories. Building simple games. STEM learning programs. Rapid prototyping of logic visually

What are the strengths of Scratch?

Beginner-friendly visual interface. No installation needed (web-based). Encourages creativity and experimentation. Safe online sharing platform. Strong global educational support

What are the limitations of Scratch?

Not suitable for advanced/large software. Limited custom logic compared to text-based languages. Performance constraints for complex games. No advanced data structures. 3D graphics not supported

How can I practice Scratch typing speed?

CodeSpeedTest offers 10+ real Scratch code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.

Learn Other Programming Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypherGremlinPartiqlHaskellElixirFsharpView all languages →
CodeSpeedTest

Improve your coding speed, code accuracy, and programming syntax WPM with practice sessions across 500+ programming languages.

Quick Links

HomeAboutFeaturesGetting StartedLanguages

Legal & Support

Pro ⚡ PricingContactPrivacy PolicyTerms of Service

Connect

CodeSpeedTest on GitHubCodeSpeedTest on TwitterEmail CodeSpeedTest

© 2026 CodeSpeedTest. All rights reserved.