US President Barack Obama has encouraged young people to “reject pessimism and cynicism” and “know that progress is possible and problems can be solved”.
Speaking in London, he said: “Take a longer, more optimistic view of history.”
Previously, Barak Obama go through the Globe theatre and observe actors perform scenes from Hamlet.
It came a day after he said Britain would be at “the back of the queue” for US trade deals if it left the EU.
His comments angered Leave campaigners. UK leader Nigel Farage accused him of doing Downing Street’s “bidding” and “talking down Britain” and Tory Liam Fox said his views were “irrelevant”.
Asked at the town-hall event about his legacy as president, Mr Obama said: “I’ll look at a scorecard at the end… I think that I have been true to myself.”
He referred to changes he had made to the US healthcare system. “That’s something I’m proud of,” he said.
“And saving the world economy from a great depression, that was pretty good.”
Asked about dealing with political opponents, Mr Obama said: “Seek out people who don’t agree with you. That will teach you to compromise.
“Compromise does not mean surrendering what you believe.”