# Formulas - Array

Updated by Dilyara

If is your first time with Formulas, please check our Getting Started guide here and our crash course here

• Contains
• GetValue
• IndexOf
• Length
• List
• Slice
• Push
• Splice

#### Contains

##### Check if array @products = ["chair","table","sofa","lamp"] contains "table"
`Contains(@products,"table")`

#### GetValue

##### Get the first value from array @products
`GetValue(@products,0)`
Keep in mind that the index of objects in array starts from 0

#### IndexOf

##### Check the position of "sofa" in array @products

`IndexOf(@products,"sofa")`

#### Length

##### Check the length of array @products
`Length(@products)`

#### List

##### Create an array out of different strings
`List(@userinput1,@userinput2,@userinput3)`

#### Slice

##### Extract first two elements from array @products
`Slice(@products,0,2)`
##### Delete first {} from an array (example @array = [{}, 'Product 1', 'Product 2']

`Slice(@array,1)`

#### Push

##### Add last user input to array @product
`Push(@products,@lastinput)`

#### Splice

##### Join 2 arrays

In case we want to join 2 arrays: @arrayone = ["one","two","three"] and @arraytwo = ["four","five"] and create a new array that will be called @finalarray:

`Splice(@arrayone,Length(@arrone),0,@arraytwo)`
##### Delete an element of an array based on a user selection.

This example is useful if you want to let the user "discard" options

If we want to delete a specific element from an array (we will use @array for the example), we don't know the position yet, but we will search for it and then delete it.

The element that we want to delete is stored in the variable @userselection

So, we have the @array = ["one","two","three"], and if the @userselection is "two", what we want to have at the end is @array = ["one","three"]

Here is the formula:

`Splice(@array,IndexOf(@array,@userselection),1)`

Here is an example: