- This article or section documents the current version of Scratch (version 3.0). For this article in Scratch 2.0, see Scripts Area.
The Code Area is the area on the left side of the project editor where scripts are assembled. It can be accessed from both the stage and from sprites, although the stage and each sprite all have separate Code Areas and scripts. It is a light gray rectangle.
Context Menu
- Main article: Context Menu
The Code Area menu consists of these options when right-clicked:
- Undo: This reverts the last edit.
- Redo: This replaces the last undone edit.
- Clean Up: This feature allows a user to organize oddly placed scripts on the Code Area. Scratch will order them vertically on the left side of the Code Area, with a slight space in between each.
- Add Comment: Comments allow for a user to type notes or helpful comments in a convenient area, usually explaining how their scripts work. The user can adjust a comment's width and height.
- Delete Blocks: Deletes all blocks in the sprite/stage.
When a user right clicks on a block in the editing area, they get the following options:
- Duplicate: Duplicates the script and allows the user to place it either somewhere else within the sprite or on another sprite. This option is not available for define blocks.
- Add Comment: Creates a comment attached to the block the user right clicked on. Despite all of their help, comments greatly slow a project's speed—they are sometimes avoided or placed detached from their wanted places in their script.[citation needed]
- Delete Block: Deletes the selected block. If a block that has reporters or booleans in its arguments or a C Block that encloses a script is selected, this option is called "Delete (amount of blocks) Blocks" and deletes the selected block along with those it contains.
- Edit: Opens the custom block edit window. This option is only available for custom blocks and define blocks.
- Substitute another variable or list: If the clicked block is a () (Variables block) or () (List block), there is an option to replace it with any other variable or any other list.
Use
To code in Scratch, simply drag blocks out from the palette and assemble them in the Code Area. You can also change values of blocks that are in the block palette, but changes back to default when the palette is redrawn. Scroll bars extend the area in all directions. A mouse or touchpad can be used to scroll the code area vertically. A touchpad can also scroll the area horizontally.
Blocks can be removed by dragging the block(s) into the block palette. Another way to delete blocks is to right-click (control-click also works on Macs) and click "Delete Block" in the drop-down menu that appears.
Switching to the Code Area
Switching to the code area is simple: click the "Code" tab above the block palette, click the X button on the top-right of the library, or click the X button on the top-right of the open tab.