Today’s Wonder of the Day was inspired by Ryan from WI. Ryan Wonders, “Why do people trick or treat on Halloween?” Thanks for WONDERing with us, Ryan!

If there are ghosts, goblins, witches, astronauts, cartoon characters, and a wild variety of oddly dressed creatures visiting your door asking for candy, chances are it's Halloween.

Before you shell out the sweets, most of these visitors probably shout “trick or treat!" But why do they do that?

In the United States and Canada, trick-or-treating has been a popular Halloween activity since the late 1950s. Children of all ages dress up in costumes and travel from house to house to receive treats in response to their call of “trick or treat!"

The phrase is a subtle suggestion that if a treat (like candy) is given, then the child will not perform a “trick" (mischief) on the owner of the house. This popular Halloween custom has its origins in the ancient practices of “souling" and “guising."

In the Middle Ages, poor people in Ireland and Britain would go “souling" on Hallowmas (November 1). “Souling" consisted of going door to door asking for food in return for saying prayers for the dead on All Souls Day (November 2).

“Guising" — the custom of wearing costumes, masks, or other forms of disguise — began in Scotland in the late 19th century. Scottish children hoped to prevent evil spirits from doing harm by dressing like them. They carried lanterns made out of hollow turnips and at various homes asked for treats, such as cakes, fruit, and money.

Immigrants brought these local customs to North America in the early 20th century. The term “trick or treat" first appeared in print in 1927 in Canada. No one knows for sure how or why that particular term came to be.

The custom of trick-or-treating started in the western United States and Canada and slowly moved eastward. The custom stalled during World War II because sugar was rationed during that time.

From the 1950s onward, however, the custom picked up steam and has been the central focus of Halloween ever since. Today, Halloween trick-or-treating is big business.

The National Confectioners Association estimates that over 75 percent of U.S. adults give out candy every year to trick-or-treaters. They also believe 64 percent of Americans will go trick-or-treating or participate in some way in Halloween activities in 2015.

As recently as 2015, Halloween candy, costumes, and related products brought in almost $7 billion in revenue.

Wonder What's Next?

We hope you bring your DANCING shoes to Wonderopolis tomorrow!