Modifier Blocks
Pop Block
Remove and return the first or last element from an array
Overview
The Pop Block removes either the first or last element from an array and outputs both the removed element and the remaining array. By default, it pops the last element. This block is useful for processing array elements one by one in a loop.
Key Features
- Removes and returns the first or last element of an array
- Outputs both the popped element and the remaining array
- Configurable to pop from the front or back of the array
- Useful for iterative array processing
Inputs
The array to pop from. Required. Non-array inputs will not be coerced.
Outputs
The popped element. Will be labeled as “First” if popping from front, “Last” if popping from back.
The remaining elements of the array after popping.
Editor Settings
If enabled, the first element of the array will be popped instead of the last.
Example: Pop the last element from an array
- Create an Array Block with values
["John", "Doe", "30", "Engineer"]
. - Add a Pop Block and connect the Array Block to its
array
input. - Run the flow. The
Last
output should be"Engineer"
and theRest
output should be["John", "Doe", "30"]
.
Example: Pop the first element from an array
- Create an Array Block with values
["John", "Doe", "30", "Engineer"]
. - Add a Pop Block, enable the
Pop from front
setting, and connect the Array Block to itsarray
input. - Run the flow. The
First
output should be"John"
and theRest
output should be["Doe", "30", "Engineer"]
.
Error Handling
The Pop Block will error if:
- The
array
input is not provided - The input is not an array
- The input array is empty