In the preceding code sample, we again declare our standard doubleEndedQueue object, and pass in our 1-6 values. We then print out the current state of our deque immediately after this so we know how our base deque looks.
We then first declare a rightPop variable, and call doubleEndedQueue.pop() in order to retrieve the rightmost value from our deque object. Immediately after this, we print the value we've just pop-ed and then the state of our deque object.
Following the same process as we did for retrieving the last value of our deque object, we can retrieve the first value of our deque object by utilizing the popleft() method. We call this and instantiate our leftPop variable with it, and again print out the current state of our deque object.