ADD


add( table , value )
table the variable name of the table
value the data to add to the table

This function inserts the given value to a table under the next available numbered key.


Example

We can create a table that is a list of color strings first and add values immediately like this:

colors = { "red", "blue", "pink", "yellow" }
Colors
1 "red"
2 "blue"
3 "pink"
4 "yellow"

Then if we want to add more values to the table, we can add another color to the list like this:

add( colors, "purple" )
Colors
1 "red"
2 "blue"
3 "pink"
4 "yellow"
5 "purple"


Images in this Guide by NerdyTeachers is licensed under CC BY-SA 4.0

1741

5 May 2023

Font