RPOP

Since 1.1.0Lists

Syntax

RPOP key [count]
  • Flags: fast, write
  • ACL categories: @fast, @list, @write
  • Arity: -2

Removes and returns the last element of the list at key. With count, removes and returns up to that many, last first. A list left empty is deleted.

Reply

  • The element, or nil if the key does not exist.
  • With count: an array of up to count elements, or nil if the key does not exist.

Examples

> RPUSH l a b c
(integer) 3
> RPOP l
"c"
> RPOP l 5
1) "b"
2) "a"