content/commands/rpop.md
Removes and returns the last elements of the list stored at key.
By default, the command pops a single element from the end of the list.
When provided with the optional count argument, the reply will consist of up
to count elements, depending on the list's length.
{{< clients-example set="cmds_list" step="rpop" description="Foundational: Remove and return the last element(s) from a list using RPOP (supports optional count parameter to pop multiple elements from tail)" difficulty="beginner" >}} redis> RPUSH mylist "one" "two" "three" "four" "five" (integer) 5 redis> RPOP mylist "five" redis> RPOP mylist 2
Give these commands a try in the interactive console:
{{% redis-cli %}} RPUSH mylist "one" "two" "three" "four" "five" RPOP mylist RPOP mylist 2 LRANGE mylist 0 -1 {{% /redis-cli %}}
| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |
{{< multitabs id="rpop-return-info" tab1="RESP2" tab2="RESP3" >}}
One of the following:
-tab-sep-
One of the following:
{{< /multitabs >}}