Add () to ()
add [thing] to [a list v]
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. It was introduced in Scratch 1.3.

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
forever
if <<key [space v] pressed?> and <touching [apple v]?>> then
if <not <[fruits v] contains [apple]>> then
add [apple] to [fruits v]
end
wait until <not <key [space v] pressed?>>

Workaround

Main article: List of Block Workarounds

This block can be replicated with the following code:

insert [item] at (length of [list v]::list) of [list v]

See Also