# insertFirst

## Description

Inserts an element to the front of a list.

## Input / Parameter

| Name  | Description                          | Input Type | Default | Options | Required |
| ----- | ------------------------------------ | ---------- | ------- | ------- | -------- |
| data  | The list to be updated.              | List       | -       | -       | Yes      |
| value | The element to be added to the list. | Any        | -       | -       | Yes      |

## Output

| Description               | Output Type |
| ------------------------- | ----------- |
| Returns the updated list. | List        |

## Example

In this example, we will insert a value in the first index of a list and print the result in the console.

### Step

1. Call the function `List.insertFirst` inside the `Log.write` function
2. Then call the function `Conversion.toList` inside the `List.insertFirst` function.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-e13881cbd1b24fa9ed5fff394a6d07849419acf1%2FinsertFirst-step-1.png?alt=media)

### Result

1. The console will print `[1,3,1,5]`.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-52374e0041b3c76255d2320d3a217040e13ef1da%2FinsertFirst-result-1.png?alt=media)

## Links

### Related Information

See also:

* Functions
  * [Conversion.toList](https://github.com/OrangeKloud/emobiq-documentation/blob/master/document/client/2-5-actions-and-visual-logic/action-reference/react-native/Conversion/toList/toList.md)
