Skip to main content

Overview

Removes and returns the last element of the list stored at key. When a count is provided, removes and returns up to count elements from the tail of the list.

Method Signature

Parameters

key
string
required
The key of the list.
count
number
The number of elements to pop from the tail. When specified, returns an array of elements instead of a single element.

Return Value

element
TData | null
When called without count: The last element of the list, or null if the list is empty or does not exist.When called with count: An array of popped elements (from tail to head), or null if the list is empty or does not exist.

Examples

Basic Usage

Pop Multiple Elements

Working with Objects

Stack Implementation

Recent Items Processing

See Also

  • LPOP - Remove and return the first element of a list
  • RPUSH - Insert elements at the tail of a list
  • LRANGE - Get a range of elements from a list
  • LLEN - Get the length of a list