m (top: template removal and cleanup)
Line 1: Line 1:
 
{{Block
 
{{Block
 
|name = Add () to ()
 
|name = Add () to ()
|image = File:2.0 Add () to ().png
+
|image = File:3.0_Add_(_)_to_().png
 
|category = [[List Blocks|List]]
 
|category = [[List Blocks|List]]
 
|type = [[Stack Block|Stack]]
 
|type = [[Stack Block|Stack]]

Revision as of 15:27, 7 January 2019

Add () to ()
3.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
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 (last v) of [list v]

See Also