Toggle Button ON OFF

I have a button that must have a text and depending on the click event, the text of the button has to be changed. I have seen examples in classes but they asked me with functions and I don’t know how to change the value of the state. And I just need every time I click it to change between ON or OFF.