Swap

Swap two elements in a list.

Input Fields

  • list (list of objects): List of items in which two will swap positions

    Click on an empty cell in each list to add a list item. A cell can contain only one list item.

  • first position (number): First of the two list items that will exchange positions; note that the first item in the list holds a position index value of 0

  • second position (number): Second of the two list items that will exchange positions

Output Fields

  • new list: Resulting list with swapped elements

Example

This is a list of six names:

Alan

Alicia

Bethany

Bob

Catherine

Charles

Bethany has a position index value of 2, and Alan has a position index value of 0. To swap their positions, enter the elements from this list in the list field, enter 0 in the first position field, and 2 in the second position field. This is the resulting list:

Bethany

Alicia

Alan

Bob

Catherine

Charles

Related topics

Functions

Workflow elements