Learn Snap - 10 Code Examples & CST Typing Practice Test
Snap! is a visual, block-based programming language based on Scratch, designed for advanced CS education. It enables functional programming, first-class procedures, lists, recursion, and custom blocks through a drag-and-drop interface.
Learn SNAP with Real Code Examples
Updated Nov 25, 2025
Code Sample Descriptions
Simple Snap! Project
when green flag clicked
forever
if <key [right] pressed?> then
move (10) steps
end
if <key [left] pressed?> then
move (-10) steps
end
end
Move sprite with arrow keys and repeat simple motion.
Snap! Hello World
when green flag clicked
say [Hello World!] for (2) secs
Displays 'Hello World!' using Say block.
Snap! Counter
when green flag clicked
set [count v] to (0)
forever
change [count v] by (1)
wait (1) secs
end
Increments a counter variable every second.
Snap! Bounce on Edge
when green flag clicked
forever
move (8) steps
if <on edge, bounce> then
turn (15) degrees
end
end
Simple bouncing ball logic.
Snap! Random Color Changer
when green flag clicked
forever
set [color v] effect to (pick random (1) to (200))
wait (0.5) secs
end
Changes sprite color randomly.
Snap! Keyboard Controlled Rotation
when green flag clicked
forever
if <key [a] pressed?> then
turn (-10) degrees
end
if <key [d] pressed?> then
turn (10) degrees
end
end
Rotate sprite with A/D keys.
Snap! Sprite Glide Demo
when green flag clicked
forever
glide (1) secs to x:(pick random (-200) to (200)) y:(pick random (-150) to (150))
end
Glide to random positions forever.
Snap! Animation Frames
when green flag clicked
forever
next costume
wait (0.2) secs
end
Switches between costumes to simulate animation.
Snap! Variable Toggle
when green flag clicked
set [active v] to [false]
forever
if <key [space] pressed?> then
if <(active) = [false]> then
set [active v] to [true]
else
set [active v] to [false]
end
wait (0.2) secs
end
end
Uses space key to toggle a boolean variable.
Snap! Simple Sound Player
when green flag clicked
forever
play sound [pop]
wait (1) secs
end
Plays a sound in a loop.
Frequently Asked Questions about Snap
What is Snap?
Snap! is a visual, block-based programming language based on Scratch, designed for advanced CS education. It enables functional programming, first-class procedures, lists, recursion, and custom blocks through a drag-and-drop interface.
What are the primary use cases for Snap?
Teaching computer science concepts. Block-based curriculum for beginners. Functional programming demonstrations. Higher-order functions in visual form. Rapid prototyping using visual logic
What are the strengths of Snap?
Beginner-friendly visual interface. Supports advanced CS concepts. Great for education and workshops. No installation required. Highly interactive and intuitive
What are the limitations of Snap?
Not suited for production software. Performance limited for large simulations. No direct low-level system access. Primarily educational in scope. Requires browser environment
How can I practice Snap typing speed?
CodeSpeedTest offers 10+ real Snap code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.