Republican presidential candidate Donald Trump said future generations of Americans will have a better chance of being successful and living happy lives if they are encouraged to live a straight-edged lifestyle.

In response to a question at a town hall event in New Hampshire, Mr. Trump urged parents to steer their children away from booze and drugs and said they can do so if they lead by example.

“If you don’t drink and you don’t do drugs, your children … are going to have a tremendously enhanced chance of really being successful and having a good life,” he said.

“The world is so tough and it is so competitive that you can’t put yourself, as a child, or even as a parent, if you want that child to be successful, at a disadvantage of letting them drink or letting them take drugs because it is not going to work,” Mr. Trump said. “They are going to be at a tremendous disadvantage and ultimately they may not recover.”

Mr. Trump said he has never had a drink of alcohol and said he drummed a simple message into his children’s heads at an early age.

“I’d say, ‘No drugs, no alcohol, no cigarettes,’” he said. “‘No drugs, no alcohol, no cigarettes.’”

Mr. Trump has shared the story of his elder brother, Fred, who was an alcoholic. Before succumbing from alcoholism at age 42, he warned Mr. Trump never to drink.

Mr. Trump has said his brother’s death had a major impact on his life and alluded to that experience Tuesday in New Hampshire.

“I’ve watched people and I study people and I had, in particular a great tutor on this, but I look and I see what it does to people when they lose control, and a lot of times they lose control,” he said.

Mr. Trump struck a lighter note, saying he does have some bad habits.

“You don’t want to know what they are,” he said.