As a writer, director and producer, Leonard Stern was a legendary (noun) in show business. He had an (adjective) career that took him to (geographic place) with (celebrity name). Fond of (article of clothing), standing (a number) feet tall with a gray (body part), he (verb) more than a share of (noun), including (liquid).

But beyond Hollywood, his legacy rests on his role as the ­co-creator of the popular word game Mad Libs. Mr. Stern died of a heart ailment June 7 at a hospital in Los Angeles. He was 88.

In a career spanning more than four decades, Mr. Stern worked as a writer and producer on 23 television shows, including the CBS sitcom “The Honeymooners.” He won an Emmy as a writer on the military satire “The Phil Silvers Show,” which starred Silvers as Master Sgt. Ernie Bilko. Mr. Stern was an executive producer and writer on the spy spoof “Get Smart” in the 1960s.

One of his more enduring contributions to comedy was his co-invention of Mad Libs, in which people fill in blank spaces — calling for nouns, adjectives, adverbs and even body parts — to form a zany, sometimes bawdy narrative. The title was a variation on the phrase used to describe improvisation: ad-libbing.

In the late 1950s, Mr. Stern’s position as a writer for NBC’s “The Steven Allen Show” helped his new game get nationwide exposure.

One night, Mr. Stern suggested that Allen play the game on the air by asking the audience for an adjective and noun to describe comedian Bob Hope.

“And here’s the scintillating Bob Hope, whose theme song is ‘Thanks for the Communist,’  ” Mr. Stern recalled in a 1994 interview in The Washington Post. “The audience would laugh uproariously, since they were in on the joke. It gave us national publicity.”

Mr. Stern said the Mad Libs titles were aimed at grown-ups, but the series became most popular with children. Today, the books are used to teach basic grammar.

“We intended the game for adults, as an icebreaker at a party,” Mr. Stern told The Post. “But the kids became possessive about it. Sales increased in the summer, when children were in camp and families took car trips. We provided measureless relief.”

Leonard Bernard Stern was born in New York on Dec. 23, 1922.

Survivors include his wife of 55 years, actress Gloria Stroock of Los Angeles; two children; two grandchildren; and a great-granddaughter.

Mr. Stern said that he got the idea for Mad Libs while writing a humor column for his high school newspaper and that he fleshed it out in 1958 with Roger Price, a fellow comedy writer.

Years later, he was writing for “The Honeymooners” when his friend Price stopped in, Mr. Stern told Publishers Weekly.

“I was trying to find the right word to describe the nose of Ralph Kramden’s new boss,” Mr. Stern said. “So I asked Roger for an idea for an adjective, and before I could tell him what it was describing, he threw out ‘clumsy’ and ‘naked.’ We both started laughing. We sat down and wrote a bunch of stories with blanks in them. That night we took them to a cocktail party, and they were a great success.”

Failing to find a willing publisher, the pair initially self-published 14,000 copies, according to Publishers Weekly. Now in its 54th year, the series has published more than 110 million copies.