What do President Barack Obama and David Letterman have in common? Both of them are getting ready to retire, sort-of. While the latter is exiting the "Late Show with David Letterman" after more than 3o years on the air, Obama will no longer write 1600 Pennsylvania Avenue as his address after a new president is chosen in the 2016 election.

The commander-in-chief walked in to a standing ovation. “Well, I feel kind of overwhelmed. I am so honored to be one of your last guests. That’s a big deal,” Obama said.

When Letterman joked that the POTUS coming to his show was more of an obligation than something he wanted to do, Obama turned the tables on the host. “First of all, I know you like Michelle a little bit more than me, which is OK,” he joked. “I assure you, you’re not alone. But I’m not going to let her have all the fun.”

On a more serious note, the president discussed the unrest in Baltimore and the issue of racism in the country. “I think this country is leaps and bounds better than it was in the recent past,” Obama said. “Our democracy works because ordinary people try to make it a little better each day… we think about not just our own kids, but all kids.”

But things didn’t stay on a solemn note for long. Things turned around when Letterman asked if “this was the first country he presidented.” Obama said it was the first and last, and added, “unlike late night hosts, I am term limited.”

The two planned their retirement together. "I was thinking you and me could play some dominoes together," the president joked when Letterman asked him about leaving the White House. "You know, go to the local Starbucks and swap stories.”

It seems like something the duo will be able to work out. “I play dominoes. I'm pretty good," Letterman answered. "I know you think I'm no good at dominoes but I'm pretty good at dominoes." 

Or maybe they’ll sit in the same class. Letterman joked he was going to teach law at Columbia, a job Obama is rumored to be taking after his presidency is over. "You know, I’d be interested in sitting in on that class. I mean, that’d be a hoot,” Obama retorted.

Obama was the first president to appear on Letterman's show back in September 2009. First Lady Michelle Obama most recently appeared on the show last week.

The POTUS finished his stint on the show with a heartfelt statement. “We’ve grown up with you,” he said. “The country I think has, you know, after a tough day at the office or coming home from work, knowing you’ve been there to give us a little bit of joy, a little bit of laughter, it has meant so much, and you’re part of all of us …you’ve given us a great gift, and we love you.”

Don’t miss the "Late Show with David Letterman,” which airs weekdays on CBS at 11.30 p.m. EDT. The final show will air May 20. After that, Stephen Colbert will replace Letterman.

Follow me on Twitter @mariamzzarella