Tutoring

Learn

Resources

# What are Variable Blocks in Scratch? Use, Types, and Many More!

Updated By

Reviewed By

Image

Blocks in Scratch are used to create different types of projects on Scratch. There are a total of 9 types of blocks on Scratch with defined function and use. Variable blocks in Scratch enable users to use to report the value of a variable. Let’s understand this block in detail, its use, its different types, and many more components.

This is Chapter 4.8 in the
Scratch Tutorial for Beginners

## What are Variable blocks in Scratch?

Variable blocks are one of the 9 categories of blocks in Scratch. There is one sub-category of blocks that comes under variable blocks, known as list blocks. Variable Blocks are orange-colored blocks specifically used to report the value of a variable. There is one sub-category of blocks that comes under variable blocks, known as list blocks. List Blocks are dark-red colored blocks specifically used to manipulate the storage of multiple values.

In Scratch, there are a total of 5 variable blocks, out of which, 4 blocks are Stack blocks and the rest 1 block is a reporter block, whereas there are a total of 12 list blocks, out of which, 7 blocks are Stack blocks, 4 blocks are reporter blocks, and the rest 1 block is Boolean block.

Stack blocks are rectangular blocks that are designed to fit above or below other blocks, Boolean blocks are elongated hexagonal blocks that are used to report only Boolean values (‘true’ or ‘false’ OR 1 or 0, depending on the requirements), and Reporter blocks are the blocks that are used to report a value that can be anything from numbers to strings.

Let’s have a look at each of the Variable blocks separately and understand their function.

### “()” Variable block

This variable block just holds the variable. Whenever a variable is created, the name of the variable appears in this block. This block comes under the category of reporter blocks.

### “set () to ()” Variable block

This variable block is used to set the specified variable to a given value, number, or string. This block comes under the category of stack blocks. The default values for this block are the name of the variable and 0, respectively.

### “change () by ()” Variable block

This variable block in Scratch is used to change the specified variable to a particular amount or string. This block comes under the category of stack blocks. The default values for this block are the name of the variable and 1, respectively.

### “show variable ()” Variable block

This variable block is used to show the specified variable on the stage or the main screen. This block comes under the category of stack blocks. The default value for this block is the name of the variable.

### “hide variable ()” Variable block

This variable block works just the opposite of the “show variable ()” block. It is used to hide the specified variable on the stage or the main screen. This block comes under the category of stack blocks. The default value for this block is the name of the variable.

Now, let’s have a look at all the List Blocks separately.

### “()” List block

This list block just reports the items of the list as a string. Whenever a list is created, the name of the list appears in this block. This block comes under the category of reporter blocks.

### “add () to ()” List Block

This list block is used to add the given input to the end of the specified list. This block comes under the category of stack blocks. The values can be added directly to the block.

### “delete () of ()” List Block

This list block is used to delete the given input from the specified list. This block comes under the category of stack blocks. The values can be added directly to the block.

### “delete all of ()” List block

This list block is used to delete all the items from the specified list. This block comes under the category of stack blocks. The values can be added directly to the block.

### “insert () at () of ()” List block

This list block is used to insert an item containing the given input into the list at a specified position. This block comes under the category of stack blocks. The values can be added directly to the block.

### “replace item () of () with ()” List block

This list block is used to replace a specified item with the last given input. This block comes under the category of stack blocks. The values can be added directly to the block.

### “item () of ()” List block

This list block is used to report the value of the specified item given as an input of the specified list. This block comes under the category of reporter blocks. The values can be added directly to the block.

### “item # () in ()” List block

This list block is used to report the index of the list where the specified item first appears. If the item is not on the list, it reports 0. This block comes under the category of reporter blocks. The values can be added directly to the block.

### “length of ()” List block

This list block is used to report the number of items present in a specified list. This block comes under the category of reporter blocks. The values can be added directly to the block.

### “() contains () ?” List block

This list block is used to check if any items specified in the given list are equal to the given input. If any one of the items of the list is equal to the given input, it returns “true”, otherwise “false”. This block comes under the category of Boolean blocks. The values can be added directly to the block.

### “show list ()” List block

This list block is used to show the specified list on the stage or the main screen. This block comes under the category of stack blocks. The values can be added directly to the block.

### “hide list ()” List block

This list block is used to hide the specified list on the stage or the main screen. This block comes under the category of stack blocks. The values can be added directly to the block.

## How to use Variable blocks in Scratch?

Variable blocks in Scratch are one of the 9 categories of blocks available in the block palette. Variable blocks are used to report the value of a variable.

To use this block, just click on the “Variables” button which is an orange-colored circle available on the left side of the screen, and then all the blocks present under the operator block will appear, as shown below.

You can even create a new variable or change the name of the existing variable by clicking on the “Make a Variable” option available on the left side of the screen, as shown below:

## How to use List Variable blocks in Scratch?

In Scratch, a list block is a sub-category of blocks that comes under Variable blocks available in the block palette. List blocks are used to manipulate the storage of multiple values.

To use this block, you first need to create a list. To make a list, just click on “Make a List”, as shown below. Once your list is created, all the list blocks appear in the block palette.

## Different Types of Blocks in Scratch

What are variable blocks in Scratch?
Variable blocks in Scratch are one of the 9 categories of blocks available in Scratch that are used to report the value of a variable.

What are the list blocks in Scratch?
A list block is a sub-category of blocks that comes under Variable blocks. List blocks are used to manipulate the storage of multiple values.

How many total variable blocks are available in Scratch?
There are a total of 5 variable blocks, out of which, 4 blocks are Stack blocks and the rest 1 block is a reporter block.

What are Scratch reporter blocks?
Reporter blocks in Scratch report a value. The value can be a number or a string. These types of blocks cannot be placed below or above any other blocks.

What is the use of variable block in Scratch?
The variable block in Scratch is used to report a value and the value can either be a number or a string. The value can be increased or decreased using an increment or decrement operator as and when required.

Which block category is used to create variables in a Scratch project?
Variable blocks can be used to create variables in a Scratch project. The Variable block contains two sub-categories, variable and list blocks which are used to store and access data.

We hope you understand what Variable Blocks and List Blocks in Scratch are and how to use them. If you have any doubts, feel free to ping us in the comment section below! If you are interested in creating games of Scratch, refer to our Scratch games blog to get some project ideas.