How to add action to button without a class

I am working on a swift playground. I am not working in a class and I have to add an action to the button when I tap it. What should I do?