Blocks - Scratch Wiki (original) (raw)

SandCastleIcon.png This article has links to websites or programs outside of Scratch and Wikipedia. Remember to stay safe while using the internet, as we cannot guarantee the safety of other websites.

when gf clicked move (10) steps say [Hello!] for (2) seconds forever if <<(score::variables) > (50)> and <touching (mouse-pointer v)?>> then dance for (2) seconds::custom broadcast (Win v) play sound (Cheer v) until done repeat (100) beep note (pitch::variables) for (0.1) secs change [pitch v] by (1)

Blocks are puzzle-piece shapes that are used to create code in Scratch. The blocks connect to each other vertically like a jigsaw puzzle, where each block type (hat, stack, reporter, boolean, or cap) has its own shape and its own slot shape for it to be inserted into. Series of connected blocks are called scripts.

Blocks are often easier to work with than text-based programming, as blocks do not need to be memorized like typed commands and syntax errors cannot occur. However, text-based programming is more flexible, as text can easily be edited without having to drag another block into the editor.

There are ten categories of blocks: Motion, Looks, Sound, Event, Control, Sensing, Operators, Variables, List, and My Blocks. The list blocks are shown under the Variables Blocks.

In total, there are eight Hat Blocks, five C Blocks, 34 Reporter Blocks, 14 Boolean Blocks, two Cap Blocks and 62 Stack Blocks, for a total of 125 blocks. (Block numbers do not include extensions.)

Block Shapes

There are six different block shapes: Hat, Stack, Boolean, Reporter, C and Cap.

Hat blocks

Main article: Hat Block

The shape of a Hat block.

Hat blocks are the blocks that start every script. They are shaped with a rounded top and a bump at the bottom — this is so that a user can only place blocks below them. There are eight Hat blocks in the Scratch editor, six of which are in the Events category, one in the Control category, and one in the category My Blocks (if one has created one custom block).

Stack blocks

The shape of a Stack block.

Main article: Stack Block

Stack blocks are the blocks that perform specific commands. They are shaped with a notch at the top and a bump on the bottom — this is so blocks can be placed above and below them. There are 62 Stack blocks — the most common block shape.

Boolean blocks

The shape of a Boolean block.

Main article: Boolean Block

Boolean blocks are blocks that act like conditions. They have an elongated hexagonal shape. Boolean blocks can hold and report "true" or "false" values. These blocks are inserted into holes of other blocks with the same shape or the shape of a reporter block (see below).

Reporter blocks

The shape of a Reporter block.

Main article: Reporter Block

Reporter blocks are blocks that act as the values. They are shaped with rounded edges. Reporter blocks can hold numbers and strings. They can also report a variable. Theoretically, there are an infinite amount of Reporter blocks that can be made for each variable and list. These blocks are inserted into holes of other blocks with the same shape.

C blocks

Main article: C Block

C blocks are blocks that take the shape of "C's". Also known as "Wrap blocks", these blocks loop the blocks within the Cs or check if a condition is true. There are five C blocks, and they can be found in the Control category. C blocks can be bumped at the bottom, allowing blocks to be attached below, or capped, which does not allow any blocks to be placed below.

Cap blocks

The shape of a Cap block.

Main article: Cap Block

Cap blocks are the blocks that end scripts. They are shaped with a notch at the top and a flat bottom — this is so blocks cannot be placed below them. There are two Cap blocks, which can both be found in the Control category.

Block Categories

Main article: Block Categories

Blocks are divided into 9 categories: Motion, Looks, Sound, Events, Control, Sensing, Operators, Variables, and My Blocks. Each category has blocks that perform a different function. There are also 11 extension categories that can be added to the block list by selecting them, and 3 Raspberry Pi extensions that are not available on other versions of Scratch. The block categories appear in the categories to the left of the Block Palette, and extensions will appear there when they are added.

List of Blocks

There are 125 normal blocks in Scratch 3.0 (not including extensions or hidden blocks). There are 80 extension blocks (not including Raspberry Pi blocks). There are also many Hidden Blocks that cannot be accessed normally.

The following is a list of said 125 blocks, divided and listed based on category:

Motion blocks

Main article: Motion Blocks

Motion blocks are the blocks that control a Sprite's movement. There are 18 Motion blocks in Scratch 3.0. The stage has no motion blocks, as it cannot move.

Motion has 15 stack blocks and 3 reporter blocks:

Looks blocks

Main article: Looks Blocks

Looks blocks are the blocks that control how a sprite looks. There are 23 Looks blocks in Scratch 3.0. Three of the 19 sprite Looks blocks have a counterpart for the Stage.

Looks has 18 stack blocks and 3 reporter blocks:

Sound blocks

Main article: Sound Blocks

Sound blocks are the blocks that control sound. There are 9 Sound blocks in Scratch 3.0. The note blocks in 3.0 have been moved to the Music Extension.

Sound has 8 stack blocks and 1 reporter block:

Events blocks

Main article: Events Blocks

Events blocks are blocks that control events and the triggering of scripts. There are 8 Event blocks in Scratch 3.0.

Events has 6 hat blocks and 2 stack blocks:

Control blocks

Main article: Control Blocks

Control blocks are the blocks that control scripts. There are 11 Control blocks in Scratch 3.0.

Control has 1 hat block, 3 stack blocks, 5 C blocks and 2 cap blcoks:

Sensing blocks

Main article: Sensing Blocks

Sensing blocks are the blocks that detect things. There are 18 Sensing blocks in Scratch 3.0.

Sensing has 3 stack blocks, 5 boolean blocks, and 10 reporter blocks:

Operators blocks

Main article: Operators Blocks

Operators blocks are the blocks that perform math functions and string handling. There are 18 Operators blocks in Scratch 3.0.

Operators has 7 boolean blocks and 11 reporter blocks:

Right-clicking some of the blocks will yield more choices of its type.

Variables blocks

Main article: Variables Blocks

Variables blocks are the blocks that hold variables and lists. There are 5 Variables blocks and 11 list blocks in Scratch 3.0.

Variables has 4 stack blocks and one reporter block for each variable created:

List blocks

Main article: List Blocks

List blocks are the blocks that manage lists. They are located in the Variables category and are not found in the bar to the left. There are 12 List blocks in Scratch 3.0.

List has 7 stack blocks, 3 reporter blocks (one additional reporter block for each list created), and 1 boolean block:

My Blocks

Main article: My Blocks

My Blocks (also known as Custom Blocks), are user-made custom blocks. There are 4 different, unique kinds of My Blocks in Scratch 3.0. Scratch 3.0 has the following My Blocks Hat block:

Scratch 3.0 has the following My Blocks Stack block:

Scratch 3.0 has the following My Blocks Boolean block:

Scratch 3.0 has the following My Blocks Reporter block:

Extensions

Main article: Extension

Scratch 3.0 has a number of extensions that can be added to the block list. To choose an extension, press the purple button below the regular block sections.

Music Extension

Main article: Music Extension

The Music extension allows one to play MIDI Notes with different instruments. There are seven Music extension blocks in Scratch 3.0.

Scratch 3.0 has six Music stack blocks and one Music reporter block:

Pen Extension

Main article: Pen Extension

The Pen extension allows one to draw on the stage with the pen. Scratch 3.0 has nine Pen stack blocks:

Video Sensing Extension

Main article: Video Sensing Extension

The Video Sensing extension lets projects interact with a webcam. There are four Video Sensing blocks in Scratch 3.0.

Scratch 3.0 has one Video Sensing hat block, one reporter block, and two stack blocks:

Text to Speech Extension

Main article: Text to Speech Extension

The Text to Speech extension allows text to be read aloud. Scratch 3.0 has three Text to Speech stack blocks:

Translate Extension

Main article: Translate Extension

The Translate extension allows text to be translated to other languages. Scratch 3.0 has two Translate reporter blocks:

Makey Makey Extension

Main article: Makey Makey Extension

The Makey Makey extension lets projects interact with the Makey Makey. Scratch 3.0 has two Makey Makey hat blocks:

micro:bit Extension

Main article: micro:bit Extension

The micro:bit extension lets projects interact with the micro:bit. There are 10 micro:bit blocks in Scratch 3.0.

Scratch 3.0 has four micro:bit hat blocks, three stack blocks, two boolean blocks, and one reporter block:

LEGO MINDSTORMS EV3 Extension

Main article: LEGO Mindstorms EV3 Extension

The LEGO MINDSTORMS EV3 extension lets projects interact with the LEGO MINDSTORMS EV3. There are 11 EV3 blocks in Scratch 3.0.

Scratch 3.0 has four EV3 stack blocks, three hat blocks, three reporter blocks, and one boolean block.

LEGO BOOST Extension

Main article: LEGO BOOST Extension

The LEGO BOOST extension lets projects interact with the LEGO BOOST. There are 12 LEGO BOOST blocks in Scratch 3.0.

Scratch 3.0 has seven Lego BOOST stack blocks, two reporter blocks, two hat blocks, and one boolean block:

LEGO Education WeDo 2.0 Extension

Main article: LEGO Education WeDo 2.0 Extension

The Lego Education WeDo 2.0 extension lets projects interact with the LEGO WeDo Construction Set. There are 11 blocks in Scratch 3.0.

Scratch 3.0 contains six Lego Education WeDo 2.0 stack blocks, two hat blocks, two reporter blocks, and one boolean block:

Go Direct Force & Acceleration Extension

Main article: Go Direct Force & Acceleration Extension

The Go Direct Force & Acceleration Extension allows users to interact with the Go Direct force sensor.

Scratch 3.0 contains 4 Go Direct Force & Acceleration reporter blocks, three hat blocks, and two boolean blocks.

Raspberry Pi Only Extensions

Main article: Raspberry Pi

There are also three extensions that are only available on the Raspberry Pi version of Scratch.

Raspberry Pi GPIO Extension

Main article: Raspberry Pi GPIO Extension

Scratch 3.0 contains 2 Raspberry Pi GPIO stack blocks, one hat block, and one boolean block.

Raspberry Pi Sense HAT Extension

Main article: Raspberry Pi Sense HAT Extension

Scratch 3.0 contains ten Raspberry Pi Sense HAT stack blocks, three hat blocks, one boolean block, and six reporter blocks.

Raspberry Pi Simple Electronics Extension

Main article: Raspberry Pi Simple Electronics Extension

Scratch 3.0 contains two Raspberry Pi Simple Electronics stack blocks, one boolean block, and one hat block.

Scratch Block Plugin

Main article: Block Plugin

The Block Plugin allows one to write blocks and scripts to appear on the Scratch Forums and Scratch Wiki, as well as other websites with the included JavaScript. It is written by the Scratcher blob8108. The dedicated forum topic for testing this plugin out can be found here.

In Other Programming Languages

Scratch is one of the original languages ever to use blocks, inspiring other languages to inherit the idea. Scratch modifications contain many new blocks typically that are not present in Scratch. MIT, where Scratch is made, has also created other languages using blocks such as the MIT App Inventor. Stencyl is a highly-professional language that features an entire block interface for programming real-time apps and online games. ScratchJr also has blocks which are even more friendly for younger children to understand.

See Also

vdeBlocks
Motion Move () Steps Turn () Degrees Go to () Go to X: () Y: () Glide () Secs to () Glide () Secs to X: () Y: () Point in Direction () Point Towards () Change X by () Set X to () Change Y by () Set Y to () If on Edge, Bounce Set Rotation Style () X Position Y Position Direction
Looks For a Sprite Say () for () Seconds Say () Think () for () Seconds Think () Switch Costume to () Next Costume Switch Backdrop to () Next Backdrop Change Size by () Set Size to ()% Change () Effect by () Set () Effect to () Clear Graphic Effects Show Hide Go to () Layer Go () () Layers Costume () Backdrop () Size For the Stage Switch Backdrop to () Switch Backdrop to () and Wait Next Backdrop Change () Effect by () Set () Effect to () Clear Graphic Effects Backdrop ()
Sound Play Sound () Until Done Start Sound () Stop All Sounds Change () Effect by () Set () Effect to () Clear Sound Effects Change Volume by () Set Volume to ()% Volume
Events When Green Flag Clicked When () Key Pressed When This Sprite Clicked When Backdrop Switches to () When () > () When I Receive () Broadcast () Broadcast () and Wait
Control Wait () Seconds Repeat () Forever If () Then If () Then, Else Wait Until () Repeat Until () Stop () When I Start as a Clone Create Clone of () Delete This Clone
Sensing Touching ()? Touching Color ()? Color () is Touching ()? Distance to () Ask () and Wait Answer (block) Key () Pressed? Mouse Down? Mouse X Mouse Y Set Drag Mode () Loudness Timer Reset Timer () of () Current () Days Since 2000 Username (block)
Operators () + () () - () () * () () / () Pick Random () to () () > () () < () () = () () and () () or () Not () Join ()() Letter () of () Length of () () Contains ()? () Mod () Round () () of ()
Variables Variables () Set () to () (block) Change () by () Show Variable () Hide Variable () Lists () Add () to () Delete () of () Delete All of () Insert () at () of () Replace Item () of () with () Item () of () Item # of () in () Length of () () Contains () Show List () Hide List ()
My Blocks Define () () (Custom block)
Extensions Music Play Drum () for () Beats Rest for () Beats Play Note () for () Beats Set Instrument to () Set Tempo to () Change Tempo by () Tempo Pen Erase All Stamp Pen Down Pen Up Set Pen Color to () Change Pen () by () Set Pen () to () Change Pen Size by () Set Pen Size to () Video Sensing When Video Motion > () Video () on () Turn Video () Set Video Transparency to () Text to Speech Speak () Set Voice to () Set Language to () Translate Translate () to () Language (block) Makey Makey When () Key Pressed (Makey Makey block) When () Pressed in Order micro:bit When () Button Pressed () Button Pressed? When () Display () Display Text () Clear Display When Tilted () Tilted ()? Tilt Angle () When Pin () Connected LEGO MINDSTORMS EV3 Motor () Turn This Way for () Seconds Motor () Turn That Way for () Seconds Motor () Set Power ()% Motor () Position When Button () Pressed When Distance < () When Brightness < () Button () Pressed Distance Brightness Beep Note () For () Secs LEGO BOOST Turn Motor () for () Seconds Turn Motor () for () Rotations Turn Motor () On Turn Motor () Off Set Motor () Speed to ()% Set Motor () Direction () Motor () Position When () Brick Seen Seeing () Brick? When Tilted () Tilt Angle () Set Light Color to () LEGO Education WeDo 2.0 Turn () On for () Seconds Turn () On Turn () Off Set () Power to () Set () Direction to () Set Light Color to () When Distance () () When Tilted () Distance Tilted ()? Tilt Angle () Go Direct Force & Acceleration When () When Force Sensor () Force When Tilted () Tilted ()? Tilt Angle () Falling? Spin Speed () Acceleration () Raspberry Pi GPIO When GPIO () is () GPIO () is ()? Set GPIO () to Output () Set GPIO () to Input () Raspberry Pi Sense HAT Display Text () Display Character () Display () Display Sprite Display Stage Clear Display Set Colour to () Set Background to () Set Pixel X () Y () to () Set Rotation to () Degrees When Joystick Pushed () When Shaken When Tilted () Temperature Pressure Humidity Roll Pitch Yaw Raspberry Pi Simple Electronics When Button () is () Button () is ()? Turn LED () () Toggle LED ()
vdeBlock Shapes
Hat Block Stack Block Boolean Block C Block Reporter Block Cap Block

The Wiki is working on a dark theme, and you're seeing it! Got feedback? Post on the Wiki Forum Topic.