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.
Learn SCRATCH with Real Code Examples
Updated Nov 25, 2025
Code Sample Descriptions
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.
Scratch - Hello World
when green flag clicked
say [Hello World!] for 2 seconds
Displays 'Hello World' when the green flag is clicked.
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.
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.
Scratch - Play Sound
when green flag clicked
play sound [meow v]
Plays a sound when the green flag is clicked.
Scratch - Follow Mouse
when green flag clicked
forever
point towards [mouse-pointer v]
move 5 steps
end
A sprite follows the mouse pointer.
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.
Scratch - Timer
when green flag clicked
reset timer
forever
say (timer)
end
Displays how long the project has been running.
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.
Scratch - Sprite Animation
when green flag clicked
forever
next costume
wait 0.1 seconds
end
Switches costumes rapidly to simulate animation.
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.