How Can We Help?

Variables

Variables

1. Make a Variable

If a reporter block you need can’t be found in any of the current block categories, you can create one by making a variable.

Click Make a Variable.

image.png

You can create multiple variables.

2. Name the variable

image.png

Name the reporter block to be created. In this example, name it new variable.

image.png

Example:

image.png

When you press the space key, the sprite says the value of the variable you have created.

3. set () to ()

Sets the specified variable to the specified value

image.png

Example:

image.png

When you press the space key, new variable is set to 100.

4. change () by ()

Changes the value of the specified variable by the specified amount

A positive value indicates increasing, and a negative one indicates decreasing.

image.png

Example:

image.png

When you press the ↑ key, new variable is increased by 10.

5. show variable ()

Displays the specified variable and its value on the stage

image.png

Example:

image.png

When you press the S key, new variable and its value are displayed on the stage.

image.png

6. hide variable ()

Hides the specified variable and its value from the stage

image.png

Example:

image.png

When you press the H key, new variable and its value are hidden from the stage.

7. Make a List

If you need to use multiple variables, you can create a list to manage them.

Click Make a List.

image.png

8. Name the list

image.png

Name the list to be created. In this example, name it new list.

image.png

9. add () to ()

Adds the specified variable to new list

image.png

Example:

image.png

When you press the space key, the sprite says the hour and minute of the time.

image.png

10. delete () of ()

Deletes the specified item from the specified list

image.png

Example:

image.png

Each time when you press the space key, the first item in new list is deleted.

new list.gif

11. delete all of ()

Deletes all items from the specified list

image.png

Example:

image.png

When you press the space key, all items are deleted from new list.

new list-1.gif

12. insert () at () of ()

Inserts the specified variable into the specified place of the specified list

image.png

Example:

image.png

When you press the space key, the sprite says the time, including the hour and minute.

Now let’s add the second of the time to the list.

image.png

When you press the I key, the sprite says time, including the hour, minute, and second.

image.png

13. replace item () of () with ()

Replaces the specified item in the specified list with the specified variable

image.png

Example:

image.png

Based on the example in 12. insert () at () of (), when you press the R key, the third item is replaced.

image.png

14. item () of ()

Reports the specified item in the specified list

image.png

15. item # of () in ()

Reports the place of the specified item in the specified list

image.png

16. length of ()

Reports the total number of items in the specified list

image.png

17. () contains ()

Determines whether the specified list contains the specified variable

image.png

18. show list ()

Displays the specified list and its variables on the stage

image.png

19. hide list ()

Hides the specified list and its variables from the stage

image.png