From Test-Scratch-Wiki

Add () to ()
2.0 Add () to ().png
Category List
Type Stack
Introduced in 1.3

The Add () to () block is a List block and a Stack block. The block adds an item onto the end of the specified list, the item containing the given text.

Example Uses

In many projects, lists continuously record variables; the record consists of the variable's current value continuously being added to the list. For the list to add more to its record, items need to be added; this block can do the job.

Some common uses for the Add () to () block:

  • Adding information to a record-keeping list
When I receive [game end v]
add (score) to [previous scores v]
  • Adding a message to a display
ask [What would you like to post?] and wait
add (answer) to [dialog v]
  • Submitting objects into a list
when gf clicked
if <<key [space v] pressed?> and <touching [apple v]?>> then
if <not <[fruits v] contains [apple]>> then
add [apple] to [fruits v]
wait until <not <key [space v] pressed?>>


Main article: List of Block Workarounds

This block can be replicated with the following code:

insert [item] at (last v) of [list v]

See Also

— the version for strings

Cookies help us deliver our services. By using our services, you agree to our use of cookies.