Standard Snap Blocks Reference

The Snap Manual details many of the operators provided in the language but is not comprehensive. The following reference is intended to provide a quick guide to every standard operator in the native set as well as a few of the libraries. The course library is documented in Drama Library Blocks Reference.

Key to Block Descriptions

Standard library
Includes the primitive blocks always available in Snap!.
Tools library
These blocks are available once Import Tools is run from the File menu.
Finch library
The blocks in the BirdBrain Finch-Chrome library, which can found in the Snap sketch loaded by the Chrome Finch Connection App.

Key to Block Arguments

The argument notation is idiosyncratic, but follows this convention:

Symbol Data Type
# numeric value
<> Boolean value
"" string
[] list
* general value (text or string)
& name of variable, sprite, operation, etc.
() procedure
[%] color (selected from color picker)
... variable number of arguments

Key to Block Shapes

Shape Category Properties
C-shaped special form accepts one or more procedures within the body
oval reporter returns a value
tabbed command called for side-effects (no return value)
hexagon predicate returns a Boolean value
hat entry point starts a thread of execution, i.e., a script
cap exit point ends a procedure or thread

Table of Blocks

Library Palette Color Shape Name Arguments Notes
Standard Control gold C-shaped forever    
Standard Control gold C-shaped if <> Boolean-value  
Standard Control gold C-shaped if <> else Boolean-value  
Standard Control gold C-shaped repeat # iteration-count  
Standard Control gold C-shaped repeat until <> Boolean-value  
Standard Control gray C-shaped warp   runs a script in turbo mode
Standard Control gold cap delete this clone    
Standard Control gold cap report * value  
Standard Control gold cap stop & script-selection  
Standard Control gold hat when & key pressed key  
Standard Control gold hat when <> Boolean-value  
Standard Control gold hat when flag clicked    
Standard Control gold hat when I am & condition-name  
Standard Control gold hat when I receive & message-name  
Standard Control gold hat when I start as a clone    
Standard Control gold oval call () reporter-function  
Standard Control gold oval call () w/continuation command-function  
Standard Control gold oval message   reports the most recently broadcast message
Standard Control gold tabbed broadcast & message-name  
Standard Control gold tabbed broadcast & and wait message-name  
Standard Control gold tabbed create a clone of & sprite  
Standard Control gold tabbed launch () command-function  
Standard Control gold tabbed pause all    
Standard Control gold tabbed run () command-function  
Standard Control gold tabbed run () w/continuation command-function  
Standard Control gold tabbed stop & script-selection  
Standard Control gold tabbed wait # seconds seconds  
Standard Control gold tabbed wait until <> Boolean-value  
Standard Looks purple oval costume   returns the current sprite costume number
Standard Looks purple oval size   returns the current size percentage
Standard Looks purple tabbed change & effect by # effect-name, value  
Standard Looks purple tabbed change size by # value  
Standard Looks purple tabbed clear graphic effects    
Standard Looks purple tabbed go back # layers value  
Standard Looks purple tabbed go to front    
Standard Looks purple tabbed hide    
Standard Looks purple tabbed next costume    
Standard Looks purple tabbed say “” string places a speech balloon near a sprite
Standard Looks purple tabbed say “” for # secs string, duration places a speech balloon near a sprite
Standard Looks purple tabbed set & effect to # effect-name, value  
Standard Looks purple tabbed set size to # % percentage-value  
Standard Looks purple tabbed show    
Standard Looks purple tabbed switch to costume & costume-name  
Standard Looks purple tabbed think “” string places a thought bubble near a sprite
Standard Looks purple tabbed think “” for # secs string, duration places a thought bubble near a sprite
Standard Motion blue oval direction    
Standard Motion blue oval x position    
Standard Motion blue oval y position    
Standard Motion blue tabbed change x by # x  
Standard Motion blue tabbed change y by # y  
Standard Motion blue tabbed glide # secs to x: # y: # duration, x, y  
Standard Motion blue tabbed go to & target-name a sprite name or mouse-pointer
Standard Motion blue tabbed go to x: # y: # x, y  
Standard Motion blue tabbed if on edge, bounce    
Standard Motion blue tabbed move # steps step-count  
Standard Motion blue tabbed point in direction # angle  
Standard Motion blue tabbed point towards & target-name a sprite name or mouse-pointer
Standard Motion blue tabbed set x to # x  
Standard Motion blue tabbed set y to # y  
Standard Motion blue tabbed turn CCW # degrees angle  
Standard Motion blue tabbed turn CW # degrees angle  
Standard Operators green hexagon # < # number, number  
Standard Operators green hexagon # < # number, number  
Standard Operators green hexagon # = # number, number  
Standard Operators green hexagon <> and <> Boolean-value, Boolean-value  
Standard Operators green hexagon <> or <> Boolean-value, Boolean-value  
Standard Operators green hexagon false    
Standard Operators green hexagon is * a &? value, type-identifier  
Standard Operators green hexagon is * identical to * ? value, value  
Standard Operators green hexagon not <> Boolean-value  
Standard Operators green hexagon true    
Standard Operators green oval & of # operator-name, number example operators are abs, sqrt, acose...
Standard Operators green oval # - # number, number  
Standard Operators green oval # * # number, number  
Standard Operators green oval # / # number, number  
Standard Operators green oval # + # number, number  
Standard Operators green oval # mod # number, number  
Standard Operators green oval JavaScript function ( “”...){“”...} args, code  
Standard Operators green oval join “” “”... string, string...  
Standard Operators green oval length of “” string  
Standard Operators green oval letter # of “” index-value, string  
Standard Operators green oval pick random # to # low-value, high-value  
Standard Operators green oval round # number  
Standard Operators green oval split “” by & string, character  
Standard Operators green oval unicode # as letter ordinal-value  
Standard Operators green oval unicode of & character  
Standard Operators gray predicate-ring     passes a procedure as a value
Standard Operators gray reporter-ring     passes a procedure as a value
Standard Operators gray command-ring     passes a procedure as a value
Standard Pen aqua tabbed change pen color by # number there are 200 pen colors
Standard Pen aqua tabbed change pen shade by # number the pen shade goes from 0 to 100
Standard Pen aqua tabbed change pen size by # pixel-value  
Standard Pen aqua tabbed clear    
Standard Pen aqua tabbed fill    
Standard Pen aqua tabbed pen down    
Standard Pen aqua tabbed pen up    
Standard Pen aqua tabbed set pen color to [%] color-selection  
Standard Pen aqua tabbed set pen color to # number  
Standard Pen aqua tabbed set pen shade to # number  
Standard Pen aqua tabbed set pen size to # pixel-value  
Standard Pen aqua tabbed stamp   stamp a print of the costume image
Standard Sensing cyan hexagon color [%] is touching [%] ? color-selection, color-selection  
Standard Sensing cyan hexagon key & pressed? key  
Standard Sensing cyan hexagon mouse down?    
Standard Sensing cyan hexagon touching [%]? color-selection  
Standard Sensing cyan hexagon touching &? sprite-name  
Standard Sensing cyan hexagon turbo mode?    
Standard Sensing cyan oval & of &? property-name, sprite-name property examples: x-position, costume name
Standard Sensing cyan oval answer    
Standard Sensing cyan oval current & time-value-name e.g. year, month, day; “time in milliseconds” is epoch time
Standard Sensing cyan oval distance to & sprite-name  
Standard Sensing cyan oval http:// “” url  
Standard Sensing cyan oval mouse x    
Standard Sensing cyan oval mouse y    
Standard Sensing cyan oval timer    
Standard Sensing cyan tabbed ask “” and wait string  
Standard Sensing cyan tabbed reset timer    
Standard Sensing cyan tabbed set turbo mode to <> Boolean-value  
Standard Sound magenta oval tempo    
Standard Sound magenta tabbed change tempo by # bpm-value  
Standard Sound magenta tabbed play note # for # beats note-number, beat-duration  
Standard Sound magenta tabbed play sound & sound-name  
Standard Sound magenta tabbed play sound & until done sound-name  
Standard Sound magenta tabbed rest for # beats beats  
Standard Sound magenta tabbed set tempo to # bpm bpm-value  
Standard Sound magenta tabbed stop all sounds    
Standard Variables orange tabbed change & by # variable-name, number  
Standard Variables orange tabbed hide-variable & variable-name hides the watcher for the variable
Standard Variables orange tabbed set & to * variable-name, value  
Standard Variables orange tabbed show variable & variable-name makes a watcher visible in the stage
Standard Variables gray tabbed script variables &... variable-name... declare script-local variables in the current scope
Standard Variables red hexagon [] contains * list, value  
Standard Variables red oval * in front of [] value, list returns a new list with the value prepended (cons)
Standard Variables red oval all but first of [] list  
Standard Variables red oval item # of [] index-value, list  
Standard Variables red oval length of [] list  
Standard Variables red oval list *... value note: list with no values returns an empty list
Standard Variables red tabbed add * to [] value, list appends an item to the end of the list
Standard Variables red tabbed delete # of [] index-value, list  
Standard Variables red tabbed insert * at # of [] value, index-value, list  
Standard Variables red tabbed replace item # of [] with * index-value, list, value  
             
             
Tools Control gold C-shaped catch & * variable-name, value  
Tools Control gold C-shaped for & = # to # variable-name, lower-value, upper-value  
Tools Control gold C-shaped if <> do and pause all Boolean-value  
Tools Control gold C-shaped tell & to sprite-name  
Tools Control gold oval ask & for () sprite-name, reporter-function  
Tools Control gold oval catch & variable-name defines a scope for throw <>
Tools Control gold oval if <> then * else * Boolean-value, value, value  
Tools Control gold tabbed ignore * value  
Tools Control gold tabbed throw & variable-name  
Tools Control gold tabbed throw & * variable-name, value  
Tools Operators green oval join words “” string  
Tools Operators green oval list -> sentence [] list  
Tools Operators green oval list -> word [] list  
Tools Operators green oval sentence -> list “” string  
Tools Operators green oval word -> list “” string  
Tools Pen aqua tabbed label “” of size # string, size-value  
Tools Variables orange C-shaped for each & of [] variable-name, list  
Tools Variables orange hexagon empty? [] list  
Tools Variables orange oval combine with () items of [] reporter-function, list  
Tools Variables orange oval keep items such that () from [] Boolean-function, list  
Tools Variables orange oval map () over [] reporter-function, list  
             
             
Finch Looks purple tabbed Finch LED R: # G: # B: # red, green, blue colors range from 0 to 100
Finch Motion blue tabbed Move Finch Left: # Right: # left-speed, right-speed speeds range from -100 to 100
Finch Motion blue tabbed Stop Finch    
Finch Sensing cyan hexagon Finch Left Obstacle    
Finch Sensing cyan hexagon Finch Right Obstacle    
Finch Sensing cyan oval Finch Accelerations   returns a list with [X,Y,Z] acceleration components
Finch Sensing cyan oval Finch Left Light Sensor    
Finch Sensing cyan oval Finch Light Sensors    
Finch Sensing cyan oval Finch Obstacles   returns list of two Booleans
Finch Sensing cyan oval Finch Orientation   returns an orientation name string, e.g. “level”, “left wing down”, etc.
Finch Sensing cyan oval Finch Right Light Sensor    
Finch Sensing cyan oval Finch Temperature Celsius    
Finch Sensing cyan oval Finch Temperature Fahrenheit    
Finch Sensing cyan oval Finch X Acceleration    
Finch Sensing cyan oval Finch Y Acceleration    
Finch Sensing cyan oval Finch Z Acceleration   ranges from 1 (right-side up) to -1 (upside-down)
Finch Sound magenta tabbed Finch Buzz+Wait # Hz # ms Hz-value, msec-duration  
Finch Sound magenta tabbed Finch Buzzer # Hz # ms Hz-value, msec-duration  
Finch Sound magenta tabbed Say This “” string performs speech synthesis on host computer