# Example of Using a For Each Activity

> To exemplify how to use a **For Each** activity, let’s create an automation that goes through each element of an array of integers and writes the length of the array and each element to the **Output** panel.

To exemplify how to use a **For Each** activity, let’s create an automation that goes through each element of an array of integers and writes the length of the array and each element to the **Output** panel.

1. Create a new sequence.
2. Create an array of integer variables, `FibonacciNumbers`.
3. In the **Default** field, type the Fibonacci sequence up to a desired value, such as {1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89}.
4. Add a **For Each** activity in the **Designer** panel.
5. Do not make any changes to the **Foreach** field.
6. In the **In** field, add the `FibonacciNumbers` variable. This activity looks at each individual item in the provided variable.
7. In the **Body** section of the **For Each** activity, add a [Write Line](https://docs.uipath.com/activities/docs/write-line) activity.
8. In the **Text** field, type "The length of this Fibonacci sequence is " + `FibonacciNumbers.Length.ToString` + " and contains the " + `item.ToString` + " element.". This expression enables you to write the total number of array elements and each element of the array in the **Output** panel.

   The final project should look as in the following screenshot.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/studio-170210-7b306b4c.webp)
9. Press F5. The automation is executed. Note that the **Output** panel displays the correct message for each element of the array.

   :::note
   The **Length** property enables you to find out the total number of array elements.
   :::

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/studio-166852-4d887a55.webp)

[Download example](https://www.uipath.com/hubfs/Documentation/WorkflowExamples/Studio_v2019-fastTrack/ForEachActivity.zip)
