Add () to ()
add [thing] to [ v]
Category List
Type Stack
Introduced in 1.3

The add () to () block is a stack block and a list block. The block adds an item containing the given text onto the end of the specified list.

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 are:

  • 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 green flag 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? > >
    end
end

Workaround

Main article: List of Block Workarounds

This block can be replicated by manually inserting the block at the item at the end:

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

See Also