How I Met Your Mother is filled with slapstick humor and touching moments. Most often, its scenes hit just the right notes in both categories. Iconic phrases that become inside jokes with the audience or ridiculous moments with Barney, Ted, Robin, Lily and Marshall screaming about something absurd are always sure to bring laughs.

RELATED: How I Met Your Mother: Every Main Character, Ranked By Funniness

Side characters sometimes bring a good sense of humor to the table throughout the series. But the main gang's antics are what make the heart of the show. The ongoing jokes are the best. Here are the 10 funniest running gags on the series, ranked.

Ted & Robin's Military Rankings

Ted and Robin looking at each other on How I Met Your Mother

Ted and Robin developed a habit of making a joke out of phrases and statements that happened to contain a military ranking. If someone used the phrase major buzzkill, they repeated it with emphasis and a mock salute.

Once Marshall made the mistake of saying, "I have a kernel stuck in my teeth" after eating popcorn, to which Ted and Robin saluted an imaginary Colonel Stuck In My Teeth. They lost that camaraderie for a while after breaking up but recovered it soon after and got the gang to join in.

Robin's Canadian Status

Robin Scherbatsky proudly touted her homeland of Canada, but her friends never missed an opportunity to poke fun at her. From using a fake Canadian accent to giving her looks of incredulity when she mentioned the famous Tim Horton's, where you could collect their trays.

In a social experiment to prove Canada isn't the greatest country as Robin claims, Barney gets the bar to chant U.S.A., but when Robin tries to get them to chant Canada, it doesn't work. But Robin fights back with jabs about America's flaws.

The Slutty Pumpkin

Ted and Naomi or "The Slutty Pumpkin" talking on How I Met Your Mother

One fateful Halloween Ted met an amazing woman while he was dressed as a hanging chad and she was dressed as a slutty pumpkin. She wrote her phone number on a candy wrapper, but he lost it. For years after that, he went to the same rooftop Halloween party dressed in the same lame costume, hoping that fate would bring them together again.

RELATED: How I Met Your Mother: 10 Worst Supporting Characters

And it did. Guest-starring Katie Holmes as the Slutty Pumpkin, the episode of her return in season seven proved not everything is as good as people remember.

The Pineapple Incident

During a blackout drunk night, Ted wakes up with a strange girl in his bed and a pineapple on his nightstand. While everyone is trying to solve the mystery of the woman he ended up with, Marshall is obsessed with where the pineapple came from.

According to the narrator, they never found out where it came from. But in a season-nine episode, it made a reappearance on Ted's psychotic mystery corkboard, complete with red yarn and all. A deleted scene revealed that Ted took it from The Captain's front porch.

Barney's Laser Tag Obsession

Every time Barney tries to get Ted out of the apartment, he invites him to laser tag. He succeeds in getting Robin out for a bro night, where she and Barney obliterate a group of children. In another episode, using humorous tropes from buddy cop movies, Barney gets banned from laser tag by the business owner.

But he soon returns when he connects with Robin's dad just before their wedding. He even creates an elaborate rehearsal dinner prank that includes him getting caught breaking into a laser tag studio.

Eating Sandwiches

HIMYM Marshall eats sandwich

As future Ted tells his children his life's story, he tries to keep things PG. At least, when it comes to his college drug use phase, he does. Rather than admit he, their Uncle Marshall and Aunt Lily all smoked weed in college, he refers to the act as eating sandwiches.

RELATED: How I Met Your Mother: 5 Best Parenting Moments On The Show (& 5 Worst)

The directors of the show committed to the bit by portraying these moments as the characters actually eating sandwiches, turning funny moments into a hilarious ongoing joke. Ted, Marshall and Lily's goofy moments when they're high turn goofier with food in hand.

The Playbook

How I Met Your Mother Barney Stinson The Playbook

Throughout the show, Barney frequently references The Playbook, an assumed fake book that delineates several ways to trick women into sleeping with the player. It turned out the tome existed and was filled with an insane number of plays, from The Cheap Trick to The Mrs. Stinsfire.

In a grand romantic gesture, Barney burned his Playbook in a fake proposal to Patrice. This was an elaborate trick for the real Final Play of getting Robin to fall in love with him and marry him. Once the player fell in love, he didn't need the book anymore.

The Slaps

How I Met Your Mother

Early in the series Barney and Marshall made a bet in which whoever was wrong about Robin's secret video would be able to slap the other. The choice was 10 slaps in succession or five slaps spread through time at the slapper's discretion.

Marshall made a show of each one, first getting Barney randomly in the bar, then at the one-man show, he put on to torture his friends, and another at their first Thanksgiving together, which he dubbed Slapsgiving. The final slap took on a legendary air with the whole gang training Marshall for it.

Barney's Mysterious Job

barney-stinson-suit-up

The gang knows Barney works at Goliath National Bank, as he gets Marshall a job in the company's legal department. But every time they ask him what he does for a living, he replies with a signature chuckle, a straightening of his tie and a, "Please."

It turns out that response is an acronym for Provide Legal Exculpation and Sign Everything. Barney works as the company's fall guy while secretly helping the FBI take down his boss, the man who stole his girlfriend Shannon all those years ago.

The Doppelgangers

How I Met Your Mother 5 Doppelgangers

Everyone finds their doppelganger throughout New York City, from Stripper Lily to Moustache Marshall. Ted finds his is a Mexican wrestler when Barney goes to Robots versus Wrestlers. In a brief flashback explanation of the doppelgangers, the narrator reveals the most problematic depiction of all as Lesbian Robin.

When Lily and Marshall decide to have a baby, they decide the sign from the universe will be to do so when they find the last doppelganger: Barney. As Barney is eager for his friends to have a baby, he tries to deceive them into believing they found the last one.

NEXT: 10 Most Iconic Phrases From How I Met Your Mother