content/commands/lpop.md
Removes and returns the first elements of the list stored at key.
By default, the command pops a single element from the beginning 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="lpop" description="Foundational: Remove and return the first element(s) from a list using LPOP (supports optional count parameter to pop multiple elements)" difficulty="beginner" >}} redis> RPUSH mylist "one" "two" "three" "four" "five" (integer) 5 redis> LPOP mylist "one" redis> LPOP mylist 2
Give these commands a try in the interactive console:
{{% redis-cli %}} RPUSH mylist "one" "two" "three" "four" "five" LPOP mylist LPOP 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="lpop-return-info" tab1="RESP2" tab2="RESP3" >}}
One of the following:
-tab-sep-
One of the following:
{{< /multitabs >}}