---
title: ROTATE
url: https://www.tines.com/docs/formulas/functions/rotate/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/docs/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# ROTATE

*[View on tines.com](https://www.tines.com/docs/formulas/functions/rotate/)*

Rotates the elements in an array by any number of steps.

**Categories:** Arrays

## Syntax

```
ROTATE(array, steps)
```

## Examples

### Example 1

Input:

```json
{
  "array": [
    "north",
    "south",
    "east",
    "west"
  ]
}
```

Formula:

```
ROTATE(array)
```

Output:

```json
[
  "south",
  "east",
  "west",
  "north"
]
```

### Example 2: Accepts a second argument to rotate by a number of steps. Goes to the provided index, then moves everything following that index to the beginning of the array.

Input:

```json
{
  "array": [
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10
  ]
}
```

Formula:

```
ROTATE(array, 7)
```

Output:

```json
[
  8,
  9,
  10,
  1,
  2,
  3,
  4,
  5,
  6,
  7
]
```

### Example 3: Accepts negative numbers to rotate in the opposite direction

Input:

```json
{
  "array": [
    "apple",
    "banana",
    "cherry",
    "date"
  ]
}
```

Formula:

```
ROTATE(array, -1)
```

Output:

```json
[
  "date",
  "apple",
  "banana",
  "cherry"
]
```

## Sample actions

```json
{
  "standardLibVersion": "36",
  "actionRuntimeVersion": "4",
  "agents": [
    {
      "disabled": false,
      "name": "ROTATE",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "message": "<<ROTATE(my_action.my_action.array1, 4)>>"
        }
      },
      "position": {
        "x": -195,
        "y": 375
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "recordType": null,
      "recordWriters": [],
      "form": null,
      "cardIconName": null,
      "createdFromTemplateGuid": null,
      "createdFromTemplateVersion": null,
      "originStoryIdentifier": "cloud:8b3d0c1d536d7aef6416b3d0e57a460a:6c8cd17db8bb0a3868840ff9d61a890b"
    },
    {
      "disabled": false,
      "name": "My Action",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "my_action": {
            "array1": [
              1,
              2,
              3,
              4,
              5,
              6
            ]
          }
        }
      },
      "position": {
        "x": -195,
        "y": 270
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "recordType": null,
      "recordWriters": [],
      "form": null,
      "cardIconName": null,
      "createdFromTemplateGuid": null,
      "createdFromTemplateVersion": null,
      "originStoryIdentifier": "cloud:8b3d0c1d536d7aef6416b3d0e57a460a:6c8cd17db8bb0a3868840ff9d61a890b"
    }
  ],
  "links": [
    {
      "sourceIdentifier": 1,
      "receiverIdentifier": 0
    }
  ],
  "diagramNotes": []
}
```
