So far we explored the commands that let you add elements to the list, and LRANGE that let you inspect ranges of the list. A fundamental functionality of Redis lists is the ability to remove, and return to the client at the same time, elements in the head or the tail of the list.
LPOP removes the first element from the list and returns it.
LPOP friends => "Sam"
RPOP removes the last element from the list and returns it.
RPOP friends => "3"
Note that the list now only has four elements:
LLEN friends => 4
LRANGE friends 0 -1 => 1) "Alice" 2) "Bob" 3) "1" 4) "2"