Remove from list by index
Function: Remove from list by index
This action allows you to precisely remove a single item from a list of values by specifying its position (index). After the item is removed, the action provides you with the updated list. This is useful when you need to manage collections of data and remove specific entries based on their order.
Input
- List: The collection of items from which you want to remove an item. If no list is provided, the action will start with an empty list.
- Index: A whole number representing the position of the item you want to remove. The first item in a list is at index 0, the second at index 1, and so on. This input is required.
Output
- Result: The updated list of values after the specified item has been removed.
Execution Flow
Real-Life Examples
Example 1: Removing a task from a to-do list
Imagine you have a list of tasks for a project, and you want to remove the third task because it's no longer relevant.
- Inputs:
- List:
["Prepare presentation", "Send meeting invites", "Review Q1 report", "Follow up with clients"] - Index:
2(because "Review Q1 report" is the third item, and lists start counting from 0)
- List:
- Result: The
Resultwill be["Prepare presentation", "Send meeting invites", "Follow up with clients"]. The "Review Q1 report" task has been removed.
Example 2: Adjusting a shopping cart
You are building an e-commerce application, and a user decides to remove the second item from their shopping cart.
- Inputs:
- List:
["Laptop", "Mouse", "Keyboard", "Monitor"] - Index:
1(to remove "Mouse")
- List:
- Result: The
Resultwill be["Laptop", "Keyboard", "Monitor"]. The "Mouse" has been removed from the cart.
Example 3: Managing a list of attendees
You have a list of registered attendees for an event, and one attendee at a specific position cancels.
- Inputs:
- List:
["Alice", "Bob", "Charlie", "David", "Eve"] - Index:
3(to remove "David")
- List:
- Result: The
Resultwill be["Alice", "Bob", "Charlie", "Eve"]. "David" has been removed from the attendee list.